pub struct Slice { /* private fields */ }
Expand description
| Slice is a simple structure containing | a pointer into some external storage and | a size. The user of a Slice must ensure that | the slice is not used after the corresponding | external storage has been deallocated. | | Multiple threads can invoke const methods on | a Slice without external synchronization, but | if any of the threads may call a non-const | method, all threads accessing the same Slice | must use external synchronization.
Implementations§
Source§impl Slice
impl Slice
Sourcepub fn from_ptr_len(d: *const u8, n: usize) -> Self
pub fn from_ptr_len(d: *const u8, n: usize) -> Self
| Create a slice that refers to d[0,n-1]. |
Sourcepub fn remove_prefix(&mut self, n: usize)
pub fn remove_prefix(&mut self, n: usize)
| Drop the first “n” bytes from this slice. |
Sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
| Return a string that contains the copy | of the referenced data. |
Sourcepub fn starts_with(&self, x: &Slice) -> bool
pub fn starts_with(&self, x: &Slice) -> bool
| Return true iff “x” is a prefix of “*this” |
Trait Implementations§
impl Eq for Slice
Auto Trait Implementations§
impl Freeze for Slice
impl RefUnwindSafe for Slice
impl !Send for Slice
impl !Sync for Slice
impl Unpin for Slice
impl UnwindSafe for Slice
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
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.