pub struct ValueRef<'a> { /* private fields */ }Expand description
ValueRef contains a &'a Value
Implementations§
Source§impl<'a> ValueRef<'a>
impl<'a> ValueRef<'a>
Sourcepub const fn new(
meta: u8,
user_meta: u8,
expires_at: u64,
version: u64,
data: &'a [u8],
) -> Self
pub const fn new( meta: u8, user_meta: u8, expires_at: u64, version: u64, data: &'a [u8], ) -> Self
Returns a ValueRef from byte slice
Sourcepub unsafe fn from_raw_value_pointer(rp: RawValuePointer) -> ValueRef<'a>
pub unsafe fn from_raw_value_pointer(rp: RawValuePointer) -> 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
Sourcepub fn set_version(&mut self, version: u64)
pub fn set_version(&mut self, version: u64)
Set the value version for this value ref
Trait Implementations§
Source§impl<'a> Ord for ValueRef<'a>
impl<'a> Ord for ValueRef<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for ValueRef<'a>
impl<'a> PartialOrd for ValueRef<'a>
Source§impl<'a> ValueExt for ValueRef<'a>
impl<'a> ValueExt for ValueRef<'a>
Source§fn as_value_ref(&self) -> ValueRef<'_>
fn as_value_ref(&self) -> ValueRef<'_>
Returns a
ValueRefSource§fn parse_value(&self) -> &[u8] ⓘ
fn parse_value(&self) -> &[u8] ⓘ
Returns the value data
Source§fn parse_value_to_bytes(&self) -> Bytes
fn parse_value_to_bytes(&self) -> Bytes
Returns the value data (do shallow copy, except
RawValuePointer)Source§fn get_user_meta(&self) -> u8
fn get_user_meta(&self) -> u8
Get the user meta
Source§fn get_expires_at(&self) -> u64
fn get_expires_at(&self) -> u64
Returns the expiration time (unix timestamp) for this value
Source§fn encoded_size(&self) -> u32
fn encoded_size(&self) -> u32
Returns the size of the Value when encoded
Source§fn 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 moreSource§fn encode_to_buf(&self, buf: impl BufMut)
fn encode_to_buf(&self, buf: impl BufMut)
Encode to a mutable buf. This function will copy the value.
Use
to_encoded, if you want a shallow copy when encoded. Read moreSource§fn to_encoded(&self) -> EncodedValue
fn to_encoded(&self) -> EncodedValue
Encode to
EncodedValue. Read moreSource§fn decode_value_ref(src: &[u8]) -> ValueRef<'_>
fn decode_value_ref(src: &[u8]) -> ValueRef<'_>
Decodes byte slice to value ref.
Source§fn decode_value(src: &[u8]) -> Value
fn decode_value(src: &[u8]) -> Value
Decodes byte slice to value.
Source§fn decode_bytes(src: Bytes) -> Value
fn decode_bytes(src: Bytes) -> Value
Decode bytes to value. (Shallow copy)
Source§fn has_prefix(&self, prefix: impl ValueExt) -> bool
fn has_prefix(&self, prefix: impl ValueExt) -> bool
Returns whether the slice self begins with prefix.
Source§fn has_suffix(&self, suffix: impl ValueExt) -> bool
fn has_suffix(&self, suffix: impl ValueExt) -> bool
Returns whether the slice self ends with suffix.
impl<'a> Copy for ValueRef<'a>
impl<'a> Eq for ValueRef<'a>
impl<'a> StructuralPartialEq for ValueRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for ValueRef<'a>
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§
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