pub struct Cursor<T> {
pub data: T,
pub offset: usize,
}
Fields§
§data: T
§offset: usize
Implementations§
Source§impl<'a, T> Cursor<&'a [T]>
impl<'a, T> Cursor<&'a [T]>
Sourcepub fn remaining_slice(&self) -> &'a [T]
pub fn remaining_slice(&self) -> &'a [T]
Returns remaining slice from the current offset. It doesn’t change the offset.
§Examples
use util_cursor::Cursor;
let mut cursor = Cursor::new([1, 2].as_ref());
assert_eq!(cursor.remaining_slice(), &[1, 2]);
cursor.offset = 42;
assert!(cursor.remaining_slice().is_empty());
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Cursor<T>where
T: Freeze,
impl<T> RefUnwindSafe for Cursor<T>where
T: RefUnwindSafe,
impl<T> Send for Cursor<T>where
T: Send,
impl<T> Sync for Cursor<T>where
T: Sync,
impl<T> Unpin for Cursor<T>where
T: Unpin,
impl<T> UnwindSafe for Cursor<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more