pub struct CharacterTransaction { /* private fields */ }Expand description
A Transaction that modifies a Character.
Implementations§
Source§impl CharacterTransaction
impl CharacterTransaction
Sourcepub fn move_to_space(space: Handle<Space>) -> Self
pub fn move_to_space(space: Handle<Space>) -> Self
Sourcepub fn body(t: BodyTransaction) -> Self
pub fn body(t: BodyTransaction) -> Self
Modify the character’s Body.
Sourcepub fn inventory(t: InventoryTransaction) -> Self
pub fn inventory(t: InventoryTransaction) -> Self
Modify the character’s Inventory.
Trait Implementations§
Source§impl Clone for CharacterTransaction
impl Clone for CharacterTransaction
Source§fn clone(&self) -> CharacterTransaction
fn clone(&self) -> CharacterTransaction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CharacterTransaction
impl Debug for CharacterTransaction
Source§impl Default for CharacterTransaction
impl Default for CharacterTransaction
Source§fn default() -> CharacterTransaction
fn default() -> CharacterTransaction
Returns the “default value” for a type. Read more
Source§impl Merge for CharacterTransaction
impl Merge for CharacterTransaction
Source§type MergeCheck = (<BodyTransaction as Merge>::MergeCheck, <InventoryTransaction as Merge>::MergeCheck)
type MergeCheck = (<BodyTransaction as Merge>::MergeCheck, <InventoryTransaction as Merge>::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.Source§type Conflict = CharacterTransactionConflict
type Conflict = CharacterTransactionConflict
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>
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 moreSource§fn commit_merge(
&mut self,
other: Self,
(body_check, inventory_check): Self::MergeCheck,
)
fn commit_merge( &mut self, other: Self, (body_check, inventory_check): 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 moreSource§impl PartialEq for CharacterTransaction
impl PartialEq for CharacterTransaction
Source§impl Transaction for CharacterTransaction
impl Transaction for CharacterTransaction
Source§type Context<'a> = ReadTicket<'a>
type Context<'a> = ReadTicket<'a>
Data which must be passed when checking the transaction.
Use
() if none is needed.Source§type CommitCheck = (<BodyTransaction as Transaction>::CommitCheck, <InventoryTransaction as Transaction>::CommitCheck)
type CommitCheck = (<BodyTransaction as Transaction>::CommitCheck, <InventoryTransaction as Transaction>::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.Source§type Output = Infallible
type Output = Infallible
The results of a
Transaction::commit() or Transaction::execute().
Each commit may produce any number of these messages. Read moreSource§type Mismatch = CharacterTransactionMismatch
type Mismatch = CharacterTransactionMismatch
Error type describing a precondition not met, returned by
Self::check(). Read moreSource§fn check(
&self,
target: &Character,
_: Self::Context<'_>,
) -> Result<Self::CommitCheck, Self::Mismatch>
fn check( &self, target: &Character, _: Self::Context<'_>, ) -> Result<Self::CommitCheck, Self::Mismatch>
Source§fn commit(
self,
target: &mut Character,
(body_check, inventory_check): Self::CommitCheck,
outputs: &mut dyn FnMut(Self::Output),
) -> Result<(), CommitError>
fn commit( self, target: &mut Character, (body_check, inventory_check): 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 moreimpl StructuralPartialEq for CharacterTransaction
Auto Trait Implementations§
impl Freeze for CharacterTransaction
impl RefUnwindSafe for CharacterTransaction
impl Send for CharacterTransaction
impl Sync for CharacterTransaction
impl Unpin for CharacterTransaction
impl UnwindSafe for CharacterTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.