pub struct Value { /* private fields */ }Expand description
A value stored in / retrieved from memcached: opaque bytes plus flags.
Implementations§
Source§impl Value
impl Value
Sourcepub fn new(data: impl Into<Bytes>, flags: u32) -> Self
pub fn new(data: impl Into<Bytes>, flags: u32) -> Self
Construct a value from raw bytes and flags.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume the value and return the raw bytes.
Sourcepub fn as_string(&self) -> Result<String>
pub fn as_string(&self) -> Result<String>
Decode the value as a UTF-8 string.
Works for values written as String/StringBuffer/StringBuilder
(marker bits) as well as plain untagged UTF-8 blobs.
Sourcepub fn as_i64(&self) -> Result<i64>
pub fn as_i64(&self) -> Result<i64>
Decode the value as a signed 64-bit integer.
Accepts 8-byte (long/date), 4-byte (int/char), 2-byte (short)
and 1-byte (byte/boolean) big-endian encodings.
Trait Implementations§
impl Eq for Value
Source§impl From<Value> for CacheEntry
impl From<Value> for CacheEntry
impl StructuralPartialEq for Value
Source§impl ToMemcacheValue for Value
impl ToMemcacheValue for Value
Source§fn to_memcache_value(self) -> Value
fn to_memcache_value(self) -> Value
Encode
self into a Value.Auto Trait Implementations§
impl !Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.