Trait llm_weaver::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.

Object Safety§

This trait is not object safe.

Implementors§