pub struct Key { /* private fields */ }Expand description
A key identifying a Value.
Implementations§
Source§impl Key
impl Key
Sourcepub const fn from_static(b: &'static [u8]) -> Key
pub const fn from_static(b: &'static [u8]) -> Key
Create a new Key from static bytes without copying.
Sourcepub const fn from_static_str(b: &'static str) -> Key
pub const fn from_static_str(b: &'static str) -> Key
Create a new Key from a &'static str without copying.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Read the key as a str slice if it can be parsed as a UTF8 string.
Sourcepub fn as_str_lossy(&self) -> Cow<'_, str>
pub fn as_str_lossy(&self) -> Cow<'_, str>
Read the key as a lossy UTF8 string with String::from_utf8_lossy.
Sourcepub fn into_string(self) -> Option<String>
pub fn into_string(self) -> Option<String>
Convert the key to a UTF8 string, if possible.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Read the inner bytes making up the key.
Sourcepub fn as_bytes_str(&self) -> Option<StrInner<Bytes>>
pub fn as_bytes_str(&self) -> Option<StrInner<Bytes>>
Parse and return the key as a Str without copying the inner contents.
Sourcepub fn cluster_hash(&self) -> u16
pub fn cluster_hash(&self) -> u16
Hash the key to find the associated cluster hash slot.
Sourcepub fn cluster_owner<C>(&self, client: &C) -> Option<Server>where
C: ClientLike,
pub fn cluster_owner<C>(&self, client: &C) -> Option<Server>where
C: ClientLike,
Read the host:port of the cluster node that owns the key if the client is clustered and the cluster state is
known.
Trait Implementations§
Source§impl Ord for Key
impl Ord for Key
Source§impl PartialOrd for Key
impl PartialOrd for Key
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl !Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more