Trait Record
pub trait Record<B>: Sendwhere
B: Backend,{
type Item<S: PrecisionSettings>: Serialize + DeserializeOwned;
// Required methods
fn into_item<S>(self) -> Self::Item<S>
where S: PrecisionSettings;
fn from_item<S>(
item: Self::Item<S>,
device: &<B as Backend>::Device,
) -> Self
where S: PrecisionSettings;
}
Expand description
Trait to define a family of types which can be recorded using any settings.
Required Associated Types§
type Item<S: PrecisionSettings>: Serialize + DeserializeOwned
type Item<S: PrecisionSettings>: Serialize + DeserializeOwned
Type of the item that can be serialized and deserialized.
Required Methods§
fn into_item<S>(self) -> Self::Item<S>where
S: PrecisionSettings,
fn into_item<S>(self) -> Self::Item<S>where
S: PrecisionSettings,
Convert the current record into the corresponding item that follows the given settings.
fn from_item<S>(item: Self::Item<S>, device: &<B as Backend>::Device) -> Selfwhere
S: PrecisionSettings,
fn from_item<S>(item: Self::Item<S>, device: &<B as Backend>::Device) -> Selfwhere
S: PrecisionSettings,
Convert the given item into a record.
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.
Implementations on Foreign Types§
§impl<B, R0, R1> Record<B> for (R0, R1)
impl<B, R0, R1> Record<B> for (R0, R1)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1)where
S: PrecisionSettings,
§impl<B, R0, R1, R2> Record<B> for (R0, R1, R2)
impl<B, R0, R1, R2> Record<B> for (R0, R1, R2)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1, R2) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3> Record<B> for (R0, R1, R2, R3)
impl<B, R0, R1, R2, R3> Record<B> for (R0, R1, R2, R3)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1, R2, R3) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4> Record<B> for (R0, R1, R2, R3, R4)
impl<B, R0, R1, R2, R3, R4> Record<B> for (R0, R1, R2, R3, R4)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1, R2, R3, R4) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4, R5> Record<B> for (R0, R1, R2, R3, R4, R5)
impl<B, R0, R1, R2, R3, R4, R5> Record<B> for (R0, R1, R2, R3, R4, R5)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1, R2, R3, R4, R5) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4, R5) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4, R5)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4, R5, R6> Record<B> for (R0, R1, R2, R3, R4, R5, R6)
impl<B, R0, R1, R2, R3, R4, R5, R6> Record<B> for (R0, R1, R2, R3, R4, R5, R6)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>)
fn into_item<S>(self) -> <(R0, R1, R2, R3, R4, R5, R6) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4, R5, R6) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4, R5, R6)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4, R5, R6, R7> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7)
impl<B, R0, R1, R2, R3, R4, R5, R6, R7> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>)
fn into_item<S>(
self,
) -> <(R0, R1, R2, R3, R4, R5, R6, R7) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4, R5, R6, R7) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4, R5, R6, R7)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8)
impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>, <R8 as Record<B>>::Item<S>)
fn into_item<S>(
self,
) -> <(R0, R1, R2, R3, R4, R5, R6, R7, R8) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4, R5, R6, R7, R8) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4, R5, R6, R7, R8)where
S: PrecisionSettings,
§impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8, R9> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9)
impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8, R9> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9)
type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>, <R8 as Record<B>>::Item<S>, <R9 as Record<B>>::Item<S>)
fn into_item<S>(
self,
) -> <(R0, R1, R2, R3, R4, R5, R6, R7, R8, R9) as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <(R0, R1, R2, R3, R4, R5, R6, R7, R8, R9) as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9)where
S: PrecisionSettings,
§impl<T, B> Record<B> for HashMap<ParamId, T>
impl<T, B> Record<B> for HashMap<ParamId, T>
type Item<S: PrecisionSettings> = HashMap<String, <T as Record<B>>::Item<S>>
fn into_item<S>(self) -> <HashMap<ParamId, T> as Record<B>>::Item<S>where
S: PrecisionSettings,
fn from_item<S>(
item: <HashMap<ParamId, T> as Record<B>>::Item<S>,
device: &<B as Backend>::Device,
) -> HashMap<ParamId, T>where
S: PrecisionSettings,
§impl<const N: usize, T, B> Record<B> for [T; N]
impl<const N: usize, T, B> Record<B> for [T; N]
§type Item<S: PrecisionSettings> = Array<N, <T as Record<B>>::Item<S>>
type Item<S: PrecisionSettings> = Array<N, <T as Record<B>>::Item<S>>
The record item is an array of the record item of the elements. The reason why we wrap the array in a struct is because serde does not support deserializing arrays of variable size, see serde/issues/1937. for backward compatibility reasons. Serde APIs were created before const generics.