Skip to main content

Problem

Struct Problem 

Source
pub struct Problem<O> {
    pub problem: Option<O>,
    pub counts: HashMap<&'static str, u64>,
}
Expand description

Wrapper around problems defined by users.

Keeps track of how many times methods such as apply, cost, gradient, jacobian, hessian, anneal and so on are called. It is used to pass the problem from one iteration of a solver to the next.

Fields§

§problem: Option<O>

Problem defined by user

§counts: HashMap<&'static str, u64>

Keeps track of how often methods of problem have been called.

Implementations§

Source§

impl<O> Problem<O>

Source

pub fn new(problem: O) -> Problem<O>

Wraps a problem into an instance of Problem.

§Example
let wrapped_problem = Problem::new(UserDefinedProblem {});
Source

pub fn problem<T, F>( &mut self, counts_string: &'static str, func: F, ) -> Result<T, Error>
where F: FnOnce(&O) -> Result<T, Error>,

Gives access to the stored problem via the closure func and keeps track of how many times the function has been called. The function counts will be passed to observers labeled with counts_string. Per convention, counts_string is chosen as <something>_count.

§Example
let cost = problem.problem("cost_count", |problem| problem.cost(&param));

This is typically used when designing a trait which optimization problems need to implement for certain solvers. For instance, for a trait Anneal used in Simulated Annealing, one would write the following to enable the solver to call .anneal(...) on an Problem directly:

pub trait Anneal {
    type Param;
    type Output;
    type Float;

    fn anneal(&self, param: &Self::Param, extent: Self::Float) -> Result<Self::Output, Error>;
}

impl<O: Anneal> Problem<O> {
    pub fn anneal(&mut self, param: &O::Param, extent: O::Float) -> Result<O::Output, Error> {
        self.problem("anneal_count", |problem| problem.anneal(param, extent))
    }
}

// ...

let new_param = problem.anneal(&param, 1.0f64);

Note that this will unfortunately only work inside the argmin crate itself due to the fact that it is not possible to impl a type from another crate. Therefore if one implements a solver outside of argmin, .problem(...) has to be called directly as shown in the first example.

Source

pub fn bulk_problem<T, F>( &mut self, counts_string: &'static str, num_param_vecs: usize, func: F, ) -> Result<T, Error>
where F: FnOnce(&O) -> Result<T, Error>,

Gives access to the stored problem via the closure func and keeps track of how many times the function has been called. In contrast to the problem method, this also allows to pass the number of parameter vectors which will be processed by the underlying problem. This is used by the bulk_* methods, which process multiple parameters at once. The function counts will be passed to observers labeled with counts_string. Per convention, counts_string is chosen as <something>_count.

Source

pub fn take_problem(&mut self) -> Option<O>

Returns the internally stored problem and replaces it with None.

§Example
let mut problem = Problem::new(UserDefinedProblem {});
let user_problem: Option<UserDefinedProblem> = problem.take_problem();

assert_eq!(user_problem.unwrap(), UserDefinedProblem {});
assert!(problem.problem.is_none());
Source

pub fn consume_problem(&mut self, other: Problem<O>)

Consumes another instance of Problem. The internally stored user defined problem of the passed Problem instance is moved to Self. The function evaluation counts are merged/summed up.

§Example
let mut problem1 = Problem::new(UserDefinedProblem {});

// Simulate function evaluation counts in `problem1`
problem1.counts.insert("cost_count", 2);

// Take the internally stored problem such that `None` remains in its place.
let _ = problem1.take_problem();
assert!(problem1.problem.is_none());

let mut problem2 = Problem::new(UserDefinedProblem {});

// Simulate function evaluation counts in `problem2`
problem2.counts.insert("cost_count", 1);
problem2.counts.insert("gradient_count", 4);

// `problem1` consumes `problem2` by moving its internally stored user defined problem and
// by merging the function evaluation counts
problem1.consume_problem(problem2);

// `problem1` now holds a problem of type `UserDefinedProblem` (taken from `problem2`)
assert_eq!(problem1.problem.unwrap(), UserDefinedProblem {});

// The function evaluation counts have been merged
assert_eq!(problem1.counts["cost_count"], 3);
assert_eq!(problem1.counts["gradient_count"], 4);
Source

pub fn consume_func_counts<O2>(&mut self, other: Problem<O2>)

Consumes another instance of Problem by summing ob the function evaluation counts. In contrast to consume_problem, the internally stored problem remains untouched. Therefore the two internally stored problems do not need to be of the same type.

§Example
let mut problem1 = Problem::new(UserDefinedProblem1 {});

// Simulate function evaluation counts in `problem1`.
problem1.counts.insert("cost_count", 2);

// Take the internally stored problem such that `None` remains in its place.
let _ = problem1.take_problem();
assert!(problem1.problem.is_none());

let mut problem2 = Problem::new(UserDefinedProblem2 {});

// Simulate function evaluation counts in `problem2`
problem2.counts.insert("cost_count", 1);
problem2.counts.insert("gradient_count", 4);

// `problem1` consumes `problem2` by merging the function evaluation counts.
problem1.consume_func_counts(problem2);

// The internally stored problem remains being `None` (in contrast to `consume_problem`).
assert!(problem1.problem.is_none());

// The function evaluation counts have been merged.
assert_eq!(problem1.counts["cost_count"], 3);
assert_eq!(problem1.counts["gradient_count"], 4);
Source

pub fn reset(&mut self)

Resets the function evaluation counts to zero.

§Example
let mut problem = Problem::new(UserDefinedProblem {});

// Simulate function evaluation counts in `problem1`.
problem.counts.insert("cost_count", 2);
problem.counts.insert("gradient_count", 4);

assert_eq!(problem.counts["cost_count"], 2);
assert_eq!(problem.counts["gradient_count"], 4);

// Set function evaluation counts to 0
problem.reset();

assert_eq!(problem.counts["cost_count"], 0);
assert_eq!(problem.counts["gradient_count"], 0);
Source

pub fn get_problem(self) -> Option<O>

Returns the internally stored user defined problem by consuming Self.

§Example
let problem = Problem::new(UserDefinedProblem {});

let user_problem = problem.get_problem();

assert_eq!(user_problem.unwrap(), UserDefinedProblem {});
Source§

impl<O> Problem<O>
where O: Operator,

Wraps a call to apply defined in the Operator trait and as such allows to call apply on an instance of Problem. Internally, the number of evaluations of apply is counted.

Source

pub fn apply( &mut self, param: &<O as Operator>::Param, ) -> Result<<O as Operator>::Output, Error>

Calls apply defined in the Operator trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Operator`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.apply(&param);

assert_eq!(problem1.counts["operator_count"], 1);
Source

pub fn bulk_apply<P>( &mut self, params: &[P], ) -> Result<Vec<<O as Operator>::Output>, Error>
where P: Borrow<<O as Operator>::Param> + SyncAlias, <O as Operator>::Output: SendAlias, O: SyncAlias,

Calls bulk_apply defined in the Operator trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Operator`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param1 = vec![2.0f64, 1.0f64];
let param2 = vec![3.0f64, 5.0f64];
let params = vec![&param1, &param2];

let res = problem1.bulk_apply(&params);

assert_eq!(problem1.counts["operator_count"], 2);
Source§

impl<O> Problem<O>
where O: CostFunction,

Wraps a call to cost defined in the CostFunction trait and as such allows to call cost on an instance of Problem. Internally, the number of evaluations of cost is counted.

Source

pub fn cost( &mut self, param: &<O as CostFunction>::Param, ) -> Result<<O as CostFunction>::Output, Error>

Calls cost defined in the CostFunction trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `CostFunction`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.cost(&param);

assert_eq!(problem1.counts["cost_count"], 1);
Source

pub fn bulk_cost<P>( &mut self, params: &[P], ) -> Result<Vec<<O as CostFunction>::Output>, Error>

Calls bulk_cost defined in the CostFunction trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `CostFunction`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param1 = vec![2.0f64, 1.0f64];
let param2 = vec![3.0f64, 5.0f64];
let params = vec![&param1, &param2];

let res = problem1.bulk_cost(&params);

assert_eq!(problem1.counts["cost_count"], 2);
Source§

impl<O> Problem<O>
where O: Gradient,

Wraps a call to gradient defined in the Gradient trait and as such allows to call gradient on an instance of Problem. Internally, the number of evaluations of gradient is counted.

Source

pub fn gradient( &mut self, param: &<O as Gradient>::Param, ) -> Result<<O as Gradient>::Gradient, Error>

Calls gradient defined in the Gradient trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Gradient`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.gradient(&param);

assert_eq!(problem1.counts["gradient_count"], 1);
Source

pub fn bulk_gradient<P>( &mut self, params: &[P], ) -> Result<Vec<<O as Gradient>::Gradient>, Error>
where P: Borrow<<O as Gradient>::Param> + SyncAlias, <O as Gradient>::Gradient: SendAlias, O: SyncAlias,

Calls bulk_gradient defined in the Gradient trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Gradient`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param1 = vec![2.0f64, 1.0f64];
let param2 = vec![3.0f64, 5.0f64];
let params = vec![&param1, &param2];

let res = problem1.bulk_gradient(&params);

assert_eq!(problem1.counts["gradient_count"], 2);
Source§

impl<O> Problem<O>
where O: Hessian,

Wraps a call to hessian defined in the Hessian trait and as such allows to call hessian on an instance of Problem. Internally, the number of evaluations of hessian is counted.

Source

pub fn hessian( &mut self, param: &<O as Hessian>::Param, ) -> Result<<O as Hessian>::Hessian, Error>

Calls hessian defined in the Hessian trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Hessian`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.hessian(&param);

assert_eq!(problem1.counts["hessian_count"], 1);
Source

pub fn bulk_hessian<P>( &mut self, params: &[P], ) -> Result<Vec<<O as Hessian>::Hessian>, Error>
where P: Borrow<<O as Hessian>::Param> + SyncAlias, <O as Hessian>::Hessian: SendAlias, O: SyncAlias,

Calls bulk_hessian defined in the Hessian trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Hessian`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param1 = vec![2.0f64, 1.0f64];
let param2 = vec![3.0f64, 5.0f64];
let params = vec![&param1, &param2];

let res = problem1.bulk_hessian(&params);

assert_eq!(problem1.counts["hessian_count"], 2);
Source§

impl<O> Problem<O>
where O: Jacobian,

Wraps a call to jacobian defined in the Jacobian trait and as such allows to call jacobian on an instance of Problem. Internally, the number of evaluations of jacobian is counted.

Source

pub fn jacobian( &mut self, param: &<O as Jacobian>::Param, ) -> Result<<O as Jacobian>::Jacobian, Error>

Calls jacobian defined in the Jacobian trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Jacobian`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.jacobian(&param);

assert_eq!(problem1.counts["jacobian_count"], 1);
Source

pub fn bulk_jacobian<P>( &mut self, params: &[P], ) -> Result<Vec<<O as Jacobian>::Jacobian>, Error>
where P: Borrow<<O as Jacobian>::Param> + SyncAlias, <O as Jacobian>::Jacobian: SendAlias, O: SyncAlias,

Calls bulk_jacobian defined in the Jacobian trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Jacobian`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let params = vec![vec![2.0f64, 1.0f64], vec![3.0f64, 5.0f64]];

let res = problem1.bulk_jacobian(&params);

assert_eq!(problem1.counts["jacobian_count"], 2);
Source§

impl<O> Problem<O>
where O: LinearProgram,

Wraps a calls to c, b and A defined in the LinearProgram trait and as such allows to call those methods on an instance of Problem.

Source

pub fn c(&self) -> Result<Vec<<O as LinearProgram>::Float>, Error>

Calls c defined in the LinearProgram trait.

§Example
// `UserDefinedProblem` implements `LinearProgram`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let c = problem1.c();
let b = problem1.b();
Source

pub fn b(&self) -> Result<Vec<<O as LinearProgram>::Float>, Error>

Calls b defined in the LinearProgram trait.

§Example
// `UserDefinedProblem` implements `LinearProgram`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let b = problem1.b();
Source

pub fn A(&self) -> Result<Vec<Vec<<O as LinearProgram>::Float>>, Error>

Calls A defined in the LinearProgram trait.

§Example
// `UserDefinedProblem` implements `LinearProgram`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let a = problem1.A();
Source§

impl<O> Problem<O>
where O: Anneal,

Wraps a call to anneal defined in the Anneal trait and as such allows to call anneal on an instance of Problem. Internally, the number of evaluations of anneal is counted.

Source

pub fn anneal( &mut self, param: &<O as Anneal>::Param, extent: <O as Anneal>::Float, ) -> Result<<O as Anneal>::Output, Error>

Calls anneal defined in the Anneal trait and keeps track of the number of evaluations.

§Example
// `UserDefinedProblem` implements `Anneal`.
let mut problem1 = Problem::new(UserDefinedProblem {});

let param = vec![2.0f64, 1.0f64];

let res = problem1.anneal(&param, 1.0);

assert_eq!(problem1.counts["anneal_count"], 1);

Trait Implementations§

Source§

impl<O> Clone for Problem<O>
where O: Clone,

Source§

fn clone(&self) -> Problem<O>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<O> Debug for Problem<O>
where O: Debug,

Source§

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

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

impl<O> Default for Problem<O>
where O: Default,

Source§

fn default() -> Problem<O>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<O> Freeze for Problem<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for Problem<O>
where O: RefUnwindSafe,

§

impl<O> Send for Problem<O>
where O: Send,

§

impl<O> Sync for Problem<O>
where O: Sync,

§

impl<O> Unpin for Problem<O>
where O: Unpin,

§

impl<O> UnsafeUnpin for Problem<O>
where O: UnsafeUnpin,

§

impl<O> UnwindSafe for Problem<O>
where O: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AlignerFor<1> for T

Source§

type Aligner = AlignTo1<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<2> for T

Source§

type Aligner = AlignTo2<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<4> for T

Source§

type Aligner = AlignTo4<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<8> for T

Source§

type Aligner = AlignTo8<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<16> for T

Source§

type Aligner = AlignTo16<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<32> for T

Source§

type Aligner = AlignTo32<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<64> for T

Source§

type Aligner = AlignTo64<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<128> for T

Source§

type Aligner = AlignTo128<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<256> for T

Source§

type Aligner = AlignTo256<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<512> for T

Source§

type Aligner = AlignTo512<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<1024> for T

Source§

type Aligner = AlignTo1024<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<2048> for T

Source§

type Aligner = AlignTo2048<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<4096> for T

Source§

type Aligner = AlignTo4096<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<8192> for T

Source§

type Aligner = AlignTo8192<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<16384> for T

Source§

type Aligner = AlignTo16384<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<32768> for T

Source§

type Aligner = AlignTo32768<T>

The AlignTo* type which aligns Self to ALIGNMENT.
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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<'a, T> RCowCompatibleRef<'a> for T
where T: Clone + 'a,

Source§

type RefC = &'a T

The (preferably) ffi-safe equivalent of &Self.
Source§

type ROwned = T

The owned version of Self::RefC.
Source§

fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC

Converts a reference to an FFI-safe type
Source§

fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T

Converts an FFI-safe type to a reference
Source§

impl<S> ROExtAcc for S

Source§

fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F

Gets a reference to a field, determined by offset. Read more
Source§

fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F

Gets a muatble reference to a field, determined by offset. Read more
Source§

fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F

Gets a const pointer to a field, the field is determined by offset. Read more
Source§

fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F

Gets a mutable pointer to a field, determined by offset. Read more
Source§

impl<S> ROExtOps<Aligned> for S

Source§

fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F

Replaces a field (determined by offset) with value, returning the previous value of the field. Read more
Source§

fn f_swap<F>(&mut self, offset: FieldOffset<S, F, Aligned>, right: &mut S)

Swaps a field (determined by offset) with the same field in right. Read more
Source§

fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> F
where F: Copy,

Gets a copy of a field (determined by offset). The field is determined by offset. Read more
Source§

impl<S> ROExtOps<Unaligned> for S

Source§

fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F

Replaces a field (determined by offset) with value, returning the previous value of the field. Read more
Source§

fn f_swap<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, right: &mut S)

Swaps a field (determined by offset) with the same field in right. Read more
Source§

fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> F
where F: Copy,

Gets a copy of a field (determined by offset). The field is determined by offset. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

fn eq_id(&self, other: &Self) -> bool

Compares the address of self with the address of other. Read more
Source§

fn piped<F, U>(self, f: F) -> U
where F: FnOnce(Self) -> U, Self: Sized,

Emulates the pipeline operator, allowing method syntax in more places. Read more
Source§

fn piped_ref<'a, F, U>(&'a self, f: F) -> U
where F: FnOnce(&'a Self) -> U,

The same as piped except that the function takes &Self Useful for functions that take &Self instead of Self. Read more
Source§

fn piped_mut<'a, F, U>(&'a mut self, f: F) -> U
where F: FnOnce(&'a mut Self) -> U,

The same as piped, except that the function takes &mut Self. Useful for functions that take &mut Self instead of Self.
Source§

fn mutated<F>(self, f: F) -> Self
where F: FnOnce(&mut Self), Self: Sized,

Mutates self using a closure taking self by mutable reference, passing it along the method chain. Read more
Source§

fn observe<F>(self, f: F) -> Self
where F: FnOnce(&Self), Self: Sized,

Observes the value of self, passing it along unmodified. Useful in long method chains. Read more
Source§

fn into_<T>(self) -> T
where Self: Into<T>,

Performs a conversion with Into. using the turbofish .into_::<_>() syntax. Read more
Source§

fn as_ref_<T>(&self) -> &T
where Self: AsRef<T>, T: ?Sized,

Performs a reference to reference conversion with AsRef, using the turbofish .as_ref_::<_>() syntax. Read more
Source§

fn as_mut_<T>(&mut self) -> &mut T
where Self: AsMut<T>, T: ?Sized,

Performs a mutable reference to mutable reference conversion with AsMut, using the turbofish .as_mut_::<_>() syntax. Read more
Source§

fn drop_(self)
where Self: Sized,

Drops self using method notation. Alternative to std::mem::drop. Read more
Source§

impl<T> SendAlias for T

Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

unsafe fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> SyncAlias for T

Source§

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

Source§

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<This> TransmuteElement for This
where This: ?Sized,

Source§

unsafe fn transmute_element<T>(self) -> Self::TransmutedPtr
where Self: CanTransmuteElement<T>,

Transmutes the element type of this pointer.. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

type Type = T

This is always Self.
Source§

fn into_type(self) -> Self::Type
where Self: Sized, Self::Type: Sized,

Converts a value back to the original type.
Source§

fn as_type(&self) -> &Self::Type

Converts a reference back to the original type.
Source§

fn as_type_mut(&mut self) -> &mut Self::Type

Converts a mutable reference back to the original type.
Source§

fn into_type_box(self: Box<Self>) -> Box<Self::Type>

Converts a box back to the original type.
Source§

fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>

Converts an Arc back to the original type. Read more
Source§

fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>

Converts an Rc back to the original type. Read more
Source§

fn from_type(this: Self::Type) -> Self
where Self: Sized, Self::Type: Sized,

Converts a value back to the original type.
Source§

fn from_type_ref(this: &Self::Type) -> &Self

Converts a reference back to the original type.
Source§

fn from_type_mut(this: &mut Self::Type) -> &mut Self

Converts a mutable reference back to the original type.
Source§

fn from_type_box(this: Box<Self::Type>) -> Box<Self>

Converts a box back to the original type.
Source§

fn from_type_arc(this: Arc<Self::Type>) -> Arc<Self>

Converts an Arc back to the original type.
Source§

fn from_type_rc(this: Rc<Self::Type>) -> Rc<Self>

Converts an Rc back to the original type.
Source§

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

Source§

fn vzip(self) -> V