Trait TapestryId

Source
pub trait TapestryId:
    Debug
    + Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn base_key(&self) -> String;
}
Expand description

Represents a unique identifier for any arbitrary entity.

This trait provides a method for generating a standardized key, which can be utilized across various implementations in the library, such as the [TapestryChest] implementation for storing keys in redis using the base_key method.

use loom::{TapestryId, Get};
use std::fmt::{Debug, Display};

struct MyTapestryId {
    id: String,
    sub_id: String,
    // ...
}

impl TapestryId for MyTapestryId {
    fn base_key(&self) -> String {
        format!("{}:{}", self.id, self.sub_id)
    }
}

Required Methods§

Source

fn base_key(&self) -> String

Returns the base key.

This method should produce a unique string identifier, that will serve as a key for associated objects or data within TapestryChestHandler implementations.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§