Enum byte::ctx::Str [−][src]
Context for &str to determine where a &str ends.
Pattern will not be included in the result
Default to NULL delimiter.
Example
use byte::*; use byte::ctx::*; let bytes: &[u8] = b"hello, world!\0"; let str: &str = bytes.read(&mut 0).unwrap(); assert_eq!(str, "hello, world!"); let str: &str = bytes.read_with(&mut 0, Str::Len(5)).unwrap(); assert_eq!(str, "hello"); let str: &str = bytes.read_with(&mut 0, Str::Delimiter(b"!"[0])).unwrap(); assert_eq!(str, "hello, world"); let str: &str = bytes.read_with(&mut 0, Str::DelimiterUntil(NULL, 5)).unwrap(); assert_eq!(str, "hello");
Variants
Take fix-length bytes as str
Take bytes until reaching a delimiter
Take bytes until either delimiter or length reached
Trait Implementations
impl Clone for Str[src]
fn clone(&self) -> Str[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for Str[src]
impl Debug for Str[src]
impl Default for Str[src]
impl Eq for Str[src]
impl PartialEq<Str> for Str[src]
impl StructuralEq for Str[src]
impl StructuralPartialEq for Str[src]
impl<'a> TryRead<'a, Str> for &'a str[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,