Struct all_is_cubes::behavior::BehaviorSetTransaction

source ·
pub struct BehaviorSetTransaction<H: BehaviorHost> { /* private fields */ }
Expand description

A Transaction that adds or modifies Behaviors in a BehaviorSet.

Implementations§

source§

impl<H: BehaviorHost> BehaviorSetTransaction<H>

source

pub fn insert(attachment: H::Attachment, behavior: Arc<dyn Behavior<H>>) -> Self

Constructs a transaction that adds a behavior to the behavior set.

Trait Implementations§

source§

impl<H: BehaviorHost> Clone for BehaviorSetTransaction<H>

source§

fn clone(&self) -> Self

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<H: Debug + BehaviorHost> Debug for BehaviorSetTransaction<H>

source§

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

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

impl<H: BehaviorHost> Default for BehaviorSetTransaction<H>

source§

fn default() -> Self

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

impl<H: BehaviorHost> Merge for BehaviorSetTransaction<H>

§

type MergeCheck = MergeCheck

Type of a value passed from Merge::check_merge to Merge::commit_merge. This may be used to pass precalculated values to speed up the merge phase, but also makes it difficult to accidentally merge without checking.
§

type Conflict = BehaviorTransactionConflict

Error type giving the reason why a merge was not possible. Read more
source§

fn check_merge(&self, other: &Self) -> Result<Self::MergeCheck, Self::Conflict>

Checks whether two transactions can be merged into a single transaction. If so, returns Ok containing data which may be passed to Self::commit_merge(). Read more
source§

fn commit_merge(&mut self, other: Self, _: Self::MergeCheck)

Combines other into self so that it has both effects simultaneously. This operation must be commutative and have Default::default() as the identity. Read more
source§

fn merge(self, other: Self) -> Result<Self, Self::Conflict>

Combines two transactions into one which has both effects simultaneously, if possible. Read more
source§

fn merge_from(&mut self, other: Self) -> Result<(), Self::Conflict>

Combines two transactions into one which has both effects simultaneously, if possible. Read more
source§

impl<H: BehaviorHost> PartialEq for BehaviorSetTransaction<H>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<H: BehaviorHost> Transaction for BehaviorSetTransaction<H>

§

type Target = BehaviorSet<H>

Type of the transaction’s target (what it can be used to mutate).
§

type CommitCheck = CommitCheck

Type of a value passed from Transaction::check to Transaction::commit. This may be used to pass precalculated values to speed up the commit phase, or even lock guards or similar, but also makes it slightly harder to accidentally call commit without check.
§

type Output = Infallible

The results of a Transaction::commit() or Transaction::execute(). Each commit may produce any number of these messages. Read more
§

type Mismatch = BehaviorTransactionMismatch

Error type describing a precondition not met, returned by Self::check(). Read more
source§

fn check( &self, target: &BehaviorSet<H>, ) -> Result<Self::CommitCheck, Self::Mismatch>

Checks whether the target’s current state meets the preconditions and returns Err if it does not. Read more
source§

fn commit( &self, target: &mut BehaviorSet<H>, _: Self::CommitCheck, _outputs: &mut dyn FnMut(Self::Output), ) -> Result<(), CommitError>

Perform the mutations specified by this transaction. The check value should have been created by a prior call to Transaction::check(). Read more
source§

fn execute( &self, target: &mut Self::Target, outputs: &mut dyn FnMut(Self::Output), ) -> Result<(), ExecuteError<Self>>

Convenience method to execute a transaction in one step. Implementations should not need to override this. Equivalent to: Read more
source§

impl<H: BehaviorHost> Eq for BehaviorSetTransaction<H>

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

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

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

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> 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> Is for T
where T: ?Sized,

§

type EqTo = T

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.