Struct blockbuffers::position::StringPosition
source · pub struct StringPosition(pub usize);
Expand description
StringPosition wrappers a position which points to a string in the buffer.
Strings are stored as vectors of u8, and it is guaranteed that there will be an extra 0 after the last item. The extra 0 does not count in length.
Example
use blockbuffers::position::StringPosition;
let buf = &[03u8, 0, 0, 0, 'b' as u8, 'b' as u8, 's' as u8, 0][..];
let pos = StringPosition(0);
assert_eq!(3, pos.len(buf));
assert_eq!("bbs", pos.as_str(buf));
Tuple Fields
0: usize
Implementations
Trait Implementations
sourceimpl Clone for StringPosition
impl Clone for StringPosition
sourcefn clone(&self) -> StringPosition
fn clone(&self) -> StringPosition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for StringPosition
impl Debug for StringPosition
sourceimpl PartialEq<StringPosition> for StringPosition
impl PartialEq<StringPosition> for StringPosition
sourcefn eq(&self, other: &StringPosition) -> bool
fn eq(&self, other: &StringPosition) -> bool
sourceimpl PartialOrd<StringPosition> for StringPosition
impl PartialOrd<StringPosition> for StringPosition
sourcefn partial_cmp(&self, other: &StringPosition) -> Option<Ordering>
fn partial_cmp(&self, other: &StringPosition) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for StringPosition
impl StructuralPartialEq for StringPosition
Auto Trait Implementations
impl RefUnwindSafe for StringPosition
impl Send for StringPosition
impl Sync for StringPosition
impl Unpin for StringPosition
impl UnwindSafe for StringPosition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more