[go: up one dir, main page]

Trait StrSlice

Source
pub trait StrSlice {
    // Required method
    fn get_slice<R>(&self, r: R) -> Option<&str>
       where R: IndexRange;
}
👎Deprecated: Use str::get with a range instead
Expand description

Extension trait for str for string slicing without panicking

Required Methods§

Source

fn get_slice<R>(&self, r: R) -> Option<&str>
where R: IndexRange,

👎Deprecated: Use str::get with a range instead

Return a slice of the string, if it is in bounds /and on character boundaries/, otherwise return None

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl StrSlice for str

Source§

fn get_slice<R>(&self, r: R) -> Option<&str>
where R: IndexRange,

👎Deprecated: Use str::get with a range instead

Implementors§