#[repr(transparent)]pub struct ValueRef<'a> { /* private fields */ }Expand description
ValueRef contains a &'a Value
Implementations
sourceimpl<'a> ValueRef<'a>
impl<'a> ValueRef<'a>
sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Converts a slice of bytes to a string, including invalid characters.
sourcepub fn to_lossy_string(&self) -> Cow<'_, str>
pub fn to_lossy_string(&self) -> Cow<'_, str>
Converts a slice of bytes to a string, including invalid characters.
sourcepub fn get_version(&self) -> u64
pub fn get_version(&self) -> u64
Get the value version
Trait Implementations
sourceimpl<'a> ValueExt for ValueRef<'a>
impl<'a> ValueExt for ValueRef<'a>
sourcefn parse_value(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
fn parse_value(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Returns the value data
sourcefn parse_value_to_bytes(&self) -> Bytes
fn parse_value_to_bytes(&self) -> Bytes
Returns the value data, shallow copy
sourcefn get_user_meta(&self) -> u8
fn get_user_meta(&self) -> u8
Get the user meta
sourcefn get_expires_at(&self) -> u64
fn get_expires_at(&self) -> u64
Returns the expiration time (unix timestamp) for this value
sourcefn encoded_size(&self) -> u32
fn encoded_size(&self) -> u32
Returns the size of the Value when encoded
sourcefn encode(&self, buf: &mut [u8])
fn encode(&self, buf: &mut [u8])
Encode to a mutable slice. This function will copy the value.
Use to_encoded, if you want a shallow copy when encoded. Read more
sourcefn to_encoded(&self) -> EncodedValue
fn to_encoded(&self) -> EncodedValue
Encode to EncodedValue. Read more
sourcefn decode_bytes(src: Bytes) -> Value
fn decode_bytes(src: Bytes) -> Value
Decode value from Bytes
sourcefn has_prefix(&self, prefix: impl ValueExt) -> bool
fn has_prefix(&self, prefix: impl ValueExt) -> bool
Returns whether the slice self begins with prefix.
sourcefn has_suffix(&self, suffix: impl ValueExt) -> bool
fn has_suffix(&self, suffix: impl ValueExt) -> bool
Returns whether the slice self ends with suffix.
sourcefn longest_prefix(&self, other: impl ValueExt) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
fn longest_prefix(&self, other: impl ValueExt) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Finds the longest shared prefix
sourcefn longest_suffix(&self, other: impl ValueExt) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
fn longest_suffix(&self, other: impl ValueExt) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Finds the longest shared suffix
impl<'a> Copy for ValueRef<'a>
impl<'a> Eq for ValueRef<'a>
impl<'a> StructuralEq for ValueRef<'a>
impl<'a> StructuralPartialEq for ValueRef<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ValueRef<'a>
impl<'a> Send for ValueRef<'a>
impl<'a> Sync for ValueRef<'a>
impl<'a> Unpin for ValueRef<'a>
impl<'a> UnwindSafe for ValueRef<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more