Trait Recorder
pub trait Recorder<B>:
Send
+ Sync
+ Default
+ Debug
+ Clonewhere
B: Backend,{
type Settings: PrecisionSettings;
type RecordArgs: Clone;
type RecordOutput;
type LoadArgs;
// Required methods
fn save_item<I>(
&self,
item: I,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>
where I: Serialize;
fn load_item<I>(
&self,
args: &mut Self::LoadArgs,
) -> Result<I, RecorderError>
where I: DeserializeOwned;
// Provided methods
fn record<R>(
&self,
record: R,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>
where R: Record<B> { ... }
fn load<R>(
&self,
args: Self::LoadArgs,
device: &<B as BackendTypes>::Device,
) -> Result<R, RecorderError>
where R: Record<B> { ... }
}Expand description
Record any item implementing Serialize and DeserializeOwned.
Required Associated Types§
type Settings: PrecisionSettings
type Settings: PrecisionSettings
Type of the settings used by the recorder.
type RecordArgs: Clone
type RecordArgs: Clone
Arguments used to record objects.
type RecordOutput
type RecordOutput
Record output type.
type LoadArgs
type LoadArgs
Arguments used to load recorded objects.
Required Methods§
fn save_item<I>(
&self,
item: I,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>where
I: Serialize,
fn save_item<I>(
&self,
item: I,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>where
I: Serialize,
fn load_item<I>(&self, args: &mut Self::LoadArgs) -> Result<I, RecorderError>where
I: DeserializeOwned,
fn load_item<I>(&self, args: &mut Self::LoadArgs) -> Result<I, RecorderError>where
I: DeserializeOwned,
Provided Methods§
fn record<R>(
&self,
record: R,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>where
R: Record<B>,
fn record<R>(
&self,
record: R,
args: Self::RecordArgs,
) -> Result<Self::RecordOutput, RecorderError>where
R: Record<B>,
fn load<R>(
&self,
args: Self::LoadArgs,
device: &<B as BackendTypes>::Device,
) -> Result<R, RecorderError>where
R: Record<B>,
fn load<R>(
&self,
args: Self::LoadArgs,
device: &<B as BackendTypes>::Device,
) -> Result<R, RecorderError>where
R: Record<B>,
Load an item from the given arguments.
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§
§impl<S, B> Recorder<B> for BinFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
impl<S, B> Recorder<B> for BinFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
§impl<S, B> Recorder<B> for BinGzFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
impl<S, B> Recorder<B> for BinGzFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
§impl<S, B> Recorder<B> for JsonGzFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
impl<S, B> Recorder<B> for JsonGzFileRecorder<S>where
S: PrecisionSettings,
B: Backend,
§impl<S, B> Recorder<B> for NamedMpkBytesRecorder<S>where
S: PrecisionSettings,
B: Backend,
Available on crate feature std only.
impl<S, B> Recorder<B> for NamedMpkBytesRecorder<S>where
S: PrecisionSettings,
B: Backend,
Available on crate feature
std only.