pub struct BackendLabel(/* private fields */);Expand description
A label identifying a cache backend.
Used for:
- Backend identification in
Backend::label() - Response source tracking in
ResponseSource::Backend - Metrics labels for composed backends (e.g., “composition.moka”)
§Example
use hitbox_core::BackendLabel;
let label = BackendLabel::new("moka");
let composed = label.compose(&BackendLabel::new("inner"));
assert_eq!(composed.as_str(), "moka.inner");Implementations§
Source§impl BackendLabel
impl BackendLabel
Sourcepub const fn new_static(s: &'static str) -> Self
pub const fn new_static(s: &'static str) -> Self
Creates a backend label from a static string (no allocation).
Sourcepub fn as_smol_str(&self) -> &SmolStr
pub fn as_smol_str(&self) -> &SmolStr
Returns a reference to the inner SmolStr.
Sourcepub fn compose(&self, other: &BackendLabel) -> Self
pub fn compose(&self, other: &BackendLabel) -> Self
Composes two labels with a dot separator: “self.other”.
Used for hierarchical naming in composition backends, e.g., “composition.moka” or “outer.inner.redis”.
Trait Implementations§
Source§impl AsRef<str> for BackendLabel
impl AsRef<str> for BackendLabel
Source§impl Clone for BackendLabel
impl Clone for BackendLabel
Source§fn clone(&self) -> BackendLabel
fn clone(&self) -> BackendLabel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackendLabel
impl Debug for BackendLabel
Source§impl Default for BackendLabel
impl Default for BackendLabel
Source§fn default() -> BackendLabel
fn default() -> BackendLabel
Returns the “default value” for a type. Read more
Source§impl Display for BackendLabel
impl Display for BackendLabel
Source§impl From<&str> for BackendLabel
impl From<&str> for BackendLabel
Source§impl From<SmolStr> for BackendLabel
impl From<SmolStr> for BackendLabel
Source§impl From<String> for BackendLabel
impl From<String> for BackendLabel
Source§impl Hash for BackendLabel
impl Hash for BackendLabel
Source§impl PartialEq for BackendLabel
impl PartialEq for BackendLabel
impl Eq for BackendLabel
impl StructuralPartialEq for BackendLabel
Auto Trait Implementations§
impl Freeze for BackendLabel
impl RefUnwindSafe for BackendLabel
impl Send for BackendLabel
impl Sync for BackendLabel
impl Unpin for BackendLabel
impl UnwindSafe for BackendLabel
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