Struct lace::Engine

source ·
pub struct Engine {
    pub states: Vec<State>,
    pub state_ids: Vec<usize>,
    pub codebook: Codebook,
    pub rng: Xoshiro256Plus,
}
Expand description

The engine runs states in parallel

Fields§

§states: Vec<State>

Vector of states

§state_ids: Vec<usize>§codebook: Codebook§rng: Xoshiro256Plus

Implementations§

source§

impl Engine

Maintains and samples states

source

pub fn new( n_states: usize, codebook: Codebook, data_source: DataSource, id_offset: usize, rng: Xoshiro256Plus ) -> Result<Self, NewEngineError>

Create a new engine

§Arguments
  • n_states: number of states
  • id_offset: the state IDs will start at id_offset. This is useful for when you run multiple engines on multiple machines and want to easily combine the states in a single Oracle after the runs
  • data_source: struct defining the type or data and path
  • id_offset: the state IDs will be 0+id_offset, ..., n_states + id_offset. If offset is helpful when you want to run a single model on multiple machines and merge the states into the same metadata folder.
  • rng: Random number generator
source

pub fn seed_from_u64(&mut self, seed: u64)

Re-seed the RNG

source

pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, Error>

Load a lacefile into an Engine.

source

pub fn del_rows_at(&mut self, ix: usize, n: usize)

Delete n rows starting at index ix.

If ix + n exceeds the number of rows, all of the rows starting at ix will be deleted.

source

pub fn del_column<Ix: ColumnIndex>( &mut self, col_ix: Ix ) -> Result<(), IndexError>

Delete the column at col_ix

§Example
use lace::examples::Example;
use lace::OracleT;

let mut engine = Example::Animals.engine().unwrap();

let shape = engine.shape();
assert_eq!(shape, (50, 85, 16));

// String index
engine.del_column("swims");
assert_eq!(engine.shape(), (50, 84, 16));

// Integer index
engine.del_column(3);
assert_eq!(engine.shape(), (50, 83, 16));

Deleting a column that does not exist returns and IndexError

let mut engine = Example::Animals.engine().unwrap();

let result = engine.del_column("likes_milk_in_coffee");
assert!(result.is_err());
source

pub fn insert_data<R: RowIndex, C: ColumnIndex>( &mut self, rows: Vec<Row<R, C>>, new_metadata: Option<ColMetadataList>, mode: WriteMode ) -> Result<InsertDataActions, InsertDataError>

Insert new, or overwrite existing data

§Notes

It is assumed that the user will run a transition after the new data are inserted. No effort is made to update any of the state according to the MCMC kernel, so the state will likely be sub optimal.

New columns are assigned to a random existing view; new rows are reassigned using the Gibbs kernel. Overwritten cells are left alone.

When extending the support of a categorical column with a value_map, you must supply an entry in column_metadata for that column, and the entry must have a value_map that contains mapping for all valid values including those being added.

§Arguments
  • rows: The rows of data containing the cells to insert or re-write
  • new_metadata: Contains the column metadata for columns to be inserted. The columns will be inserted in the order they appear in the metadata list. If there are columns that appear in the column metadata that do not appear in rows, it will cause an error.
  • mode: Defines how states may be modified.
§Example

Add a pegasus row with a few important values.

use lace::{OracleT, HasStates};
use lace_data::Datum;
use lace::{Row, Value, WriteMode};

let mut engine = Example::Animals.engine().unwrap();
let starting_rows = engine.n_rows();

let rows = vec![
    Row::<&str, &str> {
        row_ix: "pegasus".into(),
        values: vec![
            Value {
                col_ix: "flys".into(),
                value: Datum::Categorical(1_u8.into()),
            },
            Value {
                col_ix: "hooves".into(),
                value: Datum::Categorical(1_u8.into()),
            },
            Value {
                col_ix: "swims".into(),
                value: Datum::Categorical(0_u8.into()),
            },
        ]
    }
];

// Allow insert_data to add new rows, but not new columns, and prevent
// any existing data (even missing cells) from being overwritten.
let result = engine.insert_data(
    rows,
    None,
    WriteMode::unrestricted()
);

assert!(result.is_ok());
assert_eq!(engine.n_rows(), starting_rows + 1);

Add a column that may help us categorize a new type of animal. Note that Rows can be constructed from other simpler representations.

use lace_codebook::{ColMetadataList, ColMetadata, ColType, ValueMap};
use lace_stats::prior::csd::CsdHyper;

let rows: Vec<Row<&str, &str>> = vec![
    ("bat", vec![("drinks+blood", Datum::Categorical(1_u8.into()))]).into(),
    ("beaver", vec![("drinks+blood", Datum::Categorical(0_u8.into()))]).into(),
];

// The partial codebook is required to define the data type and
// distribution of new columns
let col_metadata = ColMetadataList::new(
    vec![
        ColMetadata {
            name: "drinks+blood".into(),
            coltype: ColType::Categorical {
                k: 2,
                hyper: Some(CsdHyper::default()),
                prior: None,
                value_map: ValueMap::U8(2),
            },
            notes: None,
            missing_not_at_random: false,
        }
    ]
).unwrap();
let starting_cols = engine.n_cols();

// Allow insert_data to add new columns, but not new rows, and prevent
// any existing data (even missing cells) from being overwritten.
let result = engine.insert_data(
    rows,
    Some(col_metadata),
    WriteMode::unrestricted(),
);

assert!(result.is_ok());
assert_eq!(engine.n_cols(), starting_cols + 1);

Add several new columns.

use lace_codebook::{ColMetadataList, ColMetadata, ColType, ValueMap};
use lace_stats::prior::csd::CsdHyper;

let rows: Vec<Row<&str, &str>> = vec![
    ("bat", vec![
            ("drinks+blood", Datum::Categorical(1_u8.into())),
    ]).into(),
    ("wolf", vec![
            ("drinks+blood", Datum::Categorical(1_u8.into())),
            ("howls+at+the+moon", Datum::Categorical(1_u8.into())),
    ]).into(),
];

// The partial codebook is required to define the data type and
// distribution of new columns. It must contain metadata for only the
// new columns.
let col_metadata = ColMetadataList::new(
    vec![
        ColMetadata {
            name: "drinks+blood".into(),
            coltype: ColType::Categorical {
                k: 2,
                hyper: Some(CsdHyper::default()),
                prior: None,
                value_map: ValueMap::U8(2),
            },
            notes: None,
            missing_not_at_random: false,
        },
        ColMetadata {
            name: "howls+at+the+moon".into(),
            coltype: ColType::Categorical {
                k: 2,
                hyper: Some(CsdHyper::default()),
                prior: None,
                value_map: ValueMap::U8(2),
            },
            notes: None,
            missing_not_at_random: false,
        }
    ]
).unwrap();
let starting_cols = engine.n_cols();

// Allow insert_data to add new columns, but not new rows, and prevent
// any existing data (even missing cells) from being overwritten.
let result = engine.insert_data(
    rows,
    Some(col_metadata),
    WriteMode::unrestricted(),
);

assert!(result.is_ok());
assert_eq!(engine.n_cols(), starting_cols + 2);

We could also insert to a new category. In the animals data set all values are binary, {0, 1}. What if we decided a pig was neither fierce or docile, that it was something else, that we will capture with the value ‘2’?

use lace::examples::animals;

// Get the value before we edit.
let x_before = engine.datum("pig", "fierce").unwrap();

// Turns out pigs are fierce.
assert_eq!(x_before, Datum::Categorical(1_u8.into()));

let rows: Vec<Row<&str, &str>> = vec![
    // Inserting a 2 into a binary column
    ("pig", vec![("fierce", Datum::Categorical(2_u8.into()))]).into(),
];

let result = engine.insert_data(
    rows,
    None,
    WriteMode::unrestricted(),
);

assert!(result.is_ok());

// Make sure that the 2 exists in the table
let x_after = engine.datum("pig", "fierce").unwrap();

assert_eq!(x_after, Datum::Categorical(2_u8.into()));

To add a category to a column with value_map

let mut engine = Example::Satellites.engine().unwrap();
use lace_codebook::{ColMetadata, ColType, ValueMap};
use std::collections::HashMap;

let rows: Vec<Row<&str, &str>> = vec![(
    "Artemis (Advanced Data Relay and Technology Mission Satellite)",
    vec![("Class_of_Orbit", Datum::Categorical("MEO".into()))]
).into()];

let result = engine.insert_data(
    rows,
    None,
    WriteMode::unrestricted(),
);
assert!(result.is_ok());
source

pub fn remove_data<R: RowIndex, C: ColumnIndex>( &mut self, indices: Vec<TableIndex<R, C>> ) -> Result<(), RemoveDataError>

Remove data from the engine

§Notes
  • Removing a Datum::Missing cell will do nothing
  • Removing all the cells in a row or column will completely remove that row or column
§Arguments
  • indices: A Vec of Index.
§Example

Remove a cell.

use lace::{TableIndex, OracleT};
use lace_data::Datum;

let mut engine = Example::Animals.engine().unwrap();

assert_eq!(
    engine.datum("horse", "flys").unwrap(),
    Datum::Categorical(0_u8.into()),
);

// Row and Column implement Into<TableIndex>
engine.remove_data(vec![("horse", "flys").into()]);

assert_eq!(engine.datum("horse", "flys").unwrap(), Datum::Missing);

Remove a row and column.

let mut engine = Example::Animals.engine().unwrap();

assert_eq!(engine.n_rows(), 50);
assert_eq!(engine.n_cols(), 85);

engine.remove_data(vec![
    TableIndex::Row("horse"),
    TableIndex::Column("flys"),
]);

assert_eq!(engine.n_rows(), 49);
assert_eq!(engine.n_cols(), 84);

Removing all the cells in a row, will delete the row

let mut engine = Example::Animals.engine().unwrap();

assert_eq!(engine.n_rows(), 50);
assert_eq!(engine.n_cols(), 85);

// You can convert a tuple of (row_ix, col_ix) to an Index
let ixs = (0..engine.n_cols())
    .map(|ix| TableIndex::from((6, ix)))
    .collect();

engine.remove_data(ixs);

assert_eq!(engine.n_rows(), 49);
assert_eq!(engine.n_cols(), 85);
source

pub fn cell_gibbs(&mut self, row_ix: usize, col_ix: usize)

Run the Gibbs reassignment kernel on a specific column and row withing a view. Used when the user would like to focus more updating on specific regions of the table.

§Notes
  • The entire column will be reassigned, but only the part of row within the view to which column col_ix is assigned will be updated.
  • Do not use a part of Geweke. This function assumes all transitions will be run, so it cannot be guaranteed to be valid for all Geweke configurations.
source

pub fn save<P: AsRef<Path>>( &self, path: P, ser_type: SerializedType ) -> Result<(), Error>

Save the Engine to a lacefile

source

pub fn run(&mut self, n_iters: usize) -> Result<(), Error>

Run each State in the Engine for n_iters iterations using the default algorithms and transitions. If the Engine is empty, update will immediately return.

source

pub fn update<U>( &mut self, config: EngineUpdateConfig, update_handler: U ) -> Result<(), Error>
where U: UpdateHandler,

Run each State in the Engine according to the config. If the Engine is empty, update will return immediately.

source

pub fn flatten_cols(&mut self)

Flatten the column assignment of each state so that each state has only one view

source

pub fn n_states(&self) -> usize

Returns the number of states

Trait Implementations§

source§

impl Clone for Engine

source§

fn clone(&self) -> Engine

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Engine

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Engine

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&Engine> for Metadata

source§

fn from(engine: &Engine) -> Self

Converts to this type from the input type.
source§

impl From<Engine> for Metadata

source§

fn from(engine: Engine) -> Self

Converts to this type from the input type.
source§

impl From<Oracle> for Engine

source§

fn from(oracle: Oracle) -> Self

Converts to this type from the input type.
source§

impl HasData for Engine

source§

fn summarize_feature(&self, ix: usize) -> SummaryStatistics

Summarize the data in a feature
source§

fn cell(&self, row_ix: usize, col_ix: usize) -> Datum

Return the datum in a cell
source§

impl HasStates for Engine

source§

fn states(&self) -> &Vec<State>

Get a reference to the States
source§

fn states_mut(&mut self) -> &mut Vec<State>

Get a mutable reference to the States
source§

fn n_states(&self) -> usize

Get the number of states
source§

fn n_rows(&self) -> usize

Get the number of rows in the states
source§

fn n_cols(&self) -> usize

Get the number of columns in the states
source§

impl Serialize for Engine

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<Metadata> for Engine

§

type Error = DataFieldNoneError

The type returned in the event of a conversion error.
source§

fn try_from(md: Metadata) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OracleT for T
where T: CanOracle,

source§

fn state_diagnostics(&self) -> Vec<StateDiagnostics>

Returns the diagnostics for each state
source§

fn shape(&self) -> (usize, usize, usize)

Returns a tuple containing the number of rows, the number of columns, and the number of states Read more
source§

fn is_empty(&self) -> bool

Returns true if the object is empty, having no structure to analyze.
source§

fn ftype<Ix: ColumnIndex>(&self, col_ix: Ix) -> Result<FType, IndexError>

Return the FType of the column col_ix Read more
source§

fn ftypes(&self) -> Vec<FType>

Returns a vector of the feature types of each row Read more
source§

fn summarize_col<Ix: ColumnIndex>( &self, col_ix: Ix ) -> Result<SummaryStatistics, IndexError>

Return a summary of the data in the column Read more
source§

fn depprob<Ix: ColumnIndex>( &self, col_a: Ix, col_b: Ix ) -> Result<f64, IndexError>

Estimated dependence probability between col_a and col_b Read more
source§

fn depprob_pw<'x, Ix>( &self, pairs: &'x [(Ix, Ix)] ) -> Result<Vec<f64>, IndexError>
where Ix: ColumnIndex, &'x [(Ix, Ix)]: IntoParallelIterator<Item = &'x (Ix, Ix)>,

Compute dependence probability for a list of column pairs. Read more
source§

fn _rowsim_validation( &self, row_a: usize, row_b: usize, wrt: &Option<&Vec<usize>> ) -> Result<(), RowSimError>

source§

fn rowsim<RIx: RowIndex, CIx: ColumnIndex>( &self, row_a: RIx, row_b: RIx, wrt: Option<&[CIx]>, variant: RowSimilarityVariant ) -> Result<f64, RowSimError>

Estimated row similarity between row_a and row_b Read more
source§

fn rowsim_pw<'x, RIx, CIx>( &self, pairs: &'x [(RIx, RIx)], wrt: Option<&[CIx]>, variant: RowSimilarityVariant ) -> Result<Vec<f64>, RowSimError>
where RIx: RowIndex, CIx: ColumnIndex + Sync, &'x [(RIx, RIx)]: IntoParallelIterator<Item = &'x (RIx, RIx)>,

Compute row similarity for pairs of rows Read more
source§

fn novelty<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, wrt: Option<&[CIx]> ) -> Result<f64, IndexError>

Determine the relative novelty of a row. Read more
source§

fn mi<Ix: ColumnIndex>( &self, col_a: Ix, col_b: Ix, n: usize, mi_type: MiType ) -> Result<f64, MiError>

Estimate the mutual information between col_a and col_b using Monte Carlo integration Read more
source§

fn mi_pw<Ix: ColumnIndex>( &self, col_pairs: &[(Ix, Ix)], n: usize, mi_type: MiType ) -> Result<Vec<f64>, MiError>

Compute mutual information over pairs of columns Read more
source§

fn entropy<Ix: ColumnIndex>( &self, col_ixs: &[Ix], n: usize ) -> Result<f64, EntropyError>

Estimate joint entropy Read more
Determine the set of predictors that most efficiently account for the most information in a set of target columns. Read more
source§

fn info_prop<IxT: ColumnIndex, IxX: ColumnIndex>( &self, cols_t: &[IxT], cols_x: &[IxX], n: usize ) -> Result<f64, InfoPropError>

Compute the proportion of information in cols_t accounted for by cols_x. Read more
source§

fn conditional_entropy<IxT: ColumnIndex, IxX: ColumnIndex>( &self, col_t: IxT, cols_x: &[IxX], n: usize ) -> Result<f64, ConditionalEntropyError>

Conditional entropy H(T|X) where X is lists of column indices Read more
source§

fn conditional_entropy_pw<Ix: ColumnIndex>( &self, col_pairs: &[(Ix, Ix)], n: usize, kind: ConditionalEntropyType ) -> Result<Vec<f64>, ConditionalEntropyError>

Pairwise copmutation of conditional entreopy or information proportion Read more
source§

fn surprisal<RIx: RowIndex, CIx: ColumnIndex>( &self, x: &Datum, row_ix: RIx, col_ix: CIx, state_ixs: Option<Vec<usize>> ) -> Result<Option<f64>, SurprisalError>

Negative log PDF/PMF of a datum, x, in a specific cell of the table at position row_ix, col_ix. Read more
source§

fn self_surprisal<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx, state_ixs: Option<Vec<usize>> ) -> Result<Option<f64>, SurprisalError>

Get the surprisal of the datum in a cell. Read more
source§

fn datum<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx ) -> Result<Datum, IndexError>

Get the datum at an index Read more
source§

fn logp<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ixs: &[Ix], vals: &[Vec<Datum>], given: &Given<GIx>, state_ixs_opt: Option<&[usize]> ) -> Result<Vec<f64>, LogpError>

Compute the log PDF/PMF of a set of values possibly conditioned on the values of other columns Read more
source§

fn logp_scaled<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ixs: &[Ix], vals: &[Vec<Datum>], given: &Given<GIx>, state_ixs_opt: Option<&[usize]> ) -> Result<Vec<f64>, LogpError>
where Self: Sized,

A version of logp where the likelihood are scaled by the column modes. Read more
source§

fn draw<RIx: RowIndex, CIx: ColumnIndex, R: Rng>( &self, row_ix: RIx, col_ix: CIx, n: usize, rng: &mut R ) -> Result<Vec<Datum>, IndexError>

Draw n samples from the cell at [row_ix, col_ix]. Read more
source§

fn simulate<Ix: ColumnIndex, GIx: ColumnIndex, R: Rng>( &self, col_ixs: &[Ix], given: &Given<GIx>, n: usize, state_ixs_opt: Option<Vec<usize>>, rng: &mut R ) -> Result<Vec<Vec<Datum>>, SimulateError>

Simulate values from joint or conditional distribution Read more
source§

fn impute<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx, with_uncertainty: bool ) -> Result<(Datum, Option<f64>), IndexError>

Return the most likely value for a cell in the table along with the confidence in that imputation. Read more
source§

fn predict<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ix: Ix, given: &Given<GIx>, with_uncertainty: bool, state_ixs_opt: Option<&[usize]> ) -> Result<(Datum, Option<f64>), PredictError>

Return the most likely value for a column given a set of conditions along with the confidence in that prediction. Read more
source§

fn variability<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ix: Ix, given: &Given<GIx>, state_ixs_opt: Option<&[usize]> ) -> Result<Variability, VariabilityError>

Compute the variability of a conditional distribution Read more
source§

fn feature_error<Ix: ColumnIndex>( &self, col_ix: Ix ) -> Result<(f64, f64), IndexError>

Compute the error between the observed data in a feature and the feature model. Read more
source§

fn _logp_unchecked( &self, col_ixs: &[usize], vals: &[Vec<Datum>], given: &Given<usize>, state_ixs_opt: Option<&[usize]>, scaled: bool ) -> Vec<f64>

source§

fn _simulate_unchecked<R: Rng>( &self, col_ixs: &[usize], given: &Given<usize>, n: usize, state_ixs_opt: Option<Vec<usize>>, rng: &mut R ) -> Vec<Vec<Datum>>

source§

fn _surprisal_unchecked( &self, x: &Datum, row_ix: usize, col_ix: usize, state_ixs_opt: Option<Vec<usize>> ) -> Option<f64>

source§

fn _dual_entropy(&self, col_a: usize, col_b: usize, n: usize) -> f64

specialization for column pairs. If a specialization is not founds for the specific columns types, will fall back to MC approximation
source§

fn _mi_components(&self, col_a: usize, col_b: usize, n: usize) -> MiComponents

Get the components of mutual information between two columns
source§

fn _sobol_joint_entropy(&self, col_ixs: &[usize], n: usize) -> f64

Use a Sobol QMC sequence to appropriate joint entropy Read more
source§

fn _mc_joint_entropy<R: Rng>( &self, col_ixs: &[usize], n: usize, rng: &mut R ) -> f64

source§

fn _entropy_unchecked(&self, col_ixs: &[usize], n: usize) -> f64

source§

fn _impute_uncertainty(&self, row_ix: usize, col_ix: usize) -> f64

Computes the predictive uncertainty for the datum at (row_ix, col_ix) as mean the pairwise KL divergence between the components to which the datum is assigned. Read more
source§

fn _predict_uncertainty( &self, col_ix: usize, given: &Given<usize>, state_ixs_opt: Option<&[usize]> ) -> f64

Computes the uncertainty associated with predicting the value of a features with optional given conditions. Uses Jensen-Shannon divergence computed on the mixture of mixtures. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,