[][src]Struct views::Look

pub struct Look<T, B> { /* fields omitted */ }

Temporarily look into a buffer

Similar to a slice except you're able to restore the original buffer after slicing it. This can be useful for knowing your position in the buffer and looking back. This can be done with two slices but they need to be bounds checked.

Implementations

impl<T, B: AsRef<[T]>> Look<T, B>[src]

pub fn new(buf: B) -> Look<T, B>[src]

pub fn new_with_pos(buf: B, pos: usize) -> Result<Look<T, B>, BadPos>[src]

pub fn from_slice<'a, N: AsRef<[T]> + 'a>(
    buf: B,
    slice: &'a [T]
) -> Result<Look<T, B>, BadPos>
[src]

pub fn pos(&self) -> usize[src]

pub fn into_inner(self) -> B[src]

Trait Implementations

impl<T, B: AsMut<[T]>> AsMut<[T]> for Look<T, B>[src]

impl<T, B: AsRef<[T]>> AsRef<[T]> for Look<T, B>[src]

impl<B: AsRef<[u8]>> Bytes for Look<u8, B>[src]

impl<B: AsMut<[u8]>> BytesMut for Look<u8, B>[src]

impl<T, B: AsRef<[T]>> View<T> for Look<T, B>[src]

impl<T: Copy, B: AsMut<[T]>> ViewMut<T> for Look<T, B>[src]

Auto Trait Implementations

impl<T, B> Send for Look<T, B> where
    B: Send,
    T: Send
[src]

impl<T, B> Sync for Look<T, B> where
    B: Sync,
    T: Sync
[src]

impl<T, B> Unpin for Look<T, B> where
    B: Unpin,
    T: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.