Trait surf_header::utils::Str
source · pub trait Str {
// Required methods
fn cut(&self, start: i32, end: i32, step: usize) -> String;
fn format(&self, targets: Vec<(&str, &str)>) -> String;
fn to_path(&self) -> Box<Path>;
fn to_pathbuf(&self) -> PathBuf;
fn parse_to_surf_header(&self) -> Result<HeaderInfo, Box<dyn Error>>;
}Required Methods§
sourcefn cut(&self, start: i32, end: i32, step: usize) -> String
fn cut(&self, start: i32, end: i32, step: usize) -> String
implment cut format for str and String
use doe::Str;
let a = "this is a demo {}";
let c = a.cut(-1,-2,1);
let f = a.format("so {}").format(vec![("{}","demo")]);
println!("{:?}",f);
println!("{:?}",c);sourcefn format(&self, targets: Vec<(&str, &str)>) -> String
fn format(&self, targets: Vec<(&str, &str)>) -> String
implment format for str and String
use doe::Str;
let a = "this is a demo {}";
let c = a.cut(-1,-2,1);
let f = a.format("so {}").format(vec![("{}","demo")]);
println!("{:?}",f);
println!("{:?}",c);sourcefn to_pathbuf(&self) -> PathBuf
fn to_pathbuf(&self) -> PathBuf
str String to PathBuf