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§

source

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);
source

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);
source

fn to_path(&self) -> Box<Path>

str String to Path

source

fn to_pathbuf(&self) -> PathBuf

str String to PathBuf

source

fn parse_to_surf_header(&self) -> Result<HeaderInfo, Box<dyn Error>>

Implementors§

source§

impl<S: AsRef<str>> Str for S