pub struct HybridMethodVec<'a, State, E, const D: usize>where
    State: LatticeState<D>,{ /* private fields */ }
Expand description

hybrid method that combine multiple methods. It requires that all methods return the same error. You can use AdaptorMethodError to convert the error. If you want type with different error you can use HybridMethodCouple.

Example

see level module example super.

Implementations§

source§

impl<'a, State, E, const D: usize> HybridMethodVec<'a, State, E, D>where State: LatticeState<D>,

source

pub fn methods(&self) -> &Vec<&'a mut dyn MonteCarlo<State, D, Error = E>>

get the methods

source

pub fn new_empty() -> Self

Create an empty Self.

source

pub fn with_capacity(capacity: usize) -> Self

Create an empty Self where the vector is preallocated for capacity element.

source

pub fn new(methods: Vec<&'a mut dyn MonteCarlo<State, D, Error = E>>) -> Self

Create a new Self from a list of MonteCarlo

source

pub fn methods_mut( &mut self ) -> &mut Vec<&'a mut dyn MonteCarlo<State, D, Error = E>>

Get a mutable reference to the methods used,

source

pub fn push_method( &mut self, mc_ref: &'a mut dyn MonteCarlo<State, D, Error = E> )

Add a method at the end.

source

pub fn pop_method( &mut self ) -> Option<&'a mut dyn MonteCarlo<State, D, Error = E>>

Remove a method at the end an returns it. Return None if the methods is empty.

source

pub fn len(&self) -> usize

Get the number of methods

source

pub fn is_empty(&self) -> bool

Return wether the number is zero.

Trait Implementations§

source§

impl<'a, State, E, const D: usize> AsMut<Vec<&'a mut (dyn MonteCarlo<State, D, Error = E> + 'a), Global>> for HybridMethodVec<'a, State, E, D>where State: LatticeState<D>,

source§

fn as_mut(&mut self) -> &mut Vec<&'a mut dyn MonteCarlo<State, D, Error = E>>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<'a, State, E, const D: usize> AsRef<Vec<&'a mut (dyn MonteCarlo<State, D, Error = E> + 'a), Global>> for HybridMethodVec<'a, State, E, D>where State: LatticeState<D>,

source§

fn as_ref(&self) -> &Vec<&'a mut dyn MonteCarlo<State, D, Error = E>>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a, State, E, const D: usize> Default for HybridMethodVec<'a, State, E, D>where State: LatticeState<D>,

source§

fn default() -> Self

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

impl<'a, State, E, const D: usize> MonteCarlo<State, D> for HybridMethodVec<'a, State, E, D>where State: LatticeState<D>,

§

type Error = HybridMethodVecError<E>

Error returned while getting the next element.
source§

fn next_element(&mut self, state: State) -> Result<State, Self::Error>

Do one Monte Carlo simulation step. Read more

Auto Trait Implementations§

§

impl<'a, State, E, const D: usize> !RefUnwindSafe for HybridMethodVec<'a, State, E, D>

§

impl<'a, State, E, const D: usize> !Send for HybridMethodVec<'a, State, E, D>

§

impl<'a, State, E, const D: usize> !Sync for HybridMethodVec<'a, State, E, D>

§

impl<'a, State, E, const D: usize> Unpin for HybridMethodVec<'a, State, E, D>

§

impl<'a, State, E, const D: usize> !UnwindSafe for HybridMethodVec<'a, State, E, D>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

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

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V