llm_chain::serialization

Trait StorableEntity

Source
pub trait StorableEntity: Serialize + DeserializeOwned {
    // Required method
    fn get_metadata() -> Vec<(String, String)>;

    // Provided methods
    fn to_envelope(self) -> Envelope<Self>
       where Self: Sized { ... }
    fn from_envelope(envelope: Envelope<Self>) -> Self { ... }
    fn read_file_sync(path: &str) -> Result<Self, EnvelopeError> { ... }
    fn write_file_sync(self, path: &str) -> Result<(), EnvelopeError> { ... }
}
Expand description

An entity that can be stored in an envelope.

Required Methods§

Provided Methods§

Source

fn to_envelope(self) -> Envelope<Self>
where Self: Sized,

Source

fn from_envelope(envelope: Envelope<Self>) -> Self

Source

fn read_file_sync(path: &str) -> Result<Self, EnvelopeError>

Source

fn write_file_sync(self, path: &str) -> Result<(), EnvelopeError>

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§

Source§

impl StorableEntity for llm_chain::chains::map_reduce::Chain

Implements the StorableEntity trait for the Chain struct.

This implementation provides a method for extracting metadata from a Chain instance, in order to identify it

Source§

impl StorableEntity for llm_chain::chains::sequential::Chain

Source§

impl<T> StorableEntity for Data<T>