[][src]Struct bookkeeping::Move

pub struct Move<T: Metadata> { /* fields omitted */ }

Represents a move of a Sum of Units from one account to another.

Implementations

impl<T: Metadata> Move<T>[src]

pub fn set_metadata(&self, meta: T::Move)[src]

Sets the metadata value on this entity.

pub fn get_metadata(&self) -> Ref<'_, T::Move>[src]

Gets the metadata value on this entity.

Internally, the field that holds metadata is an std::cell::RefCell. Ideally, I would not like to leak this detail through the public API by returning std::cell::Ref here. Yet, I'm not sure what the alternative is. Perhaps returning a clone?

impl<T: Metadata> Move<T>[src]

pub fn new(
    debit_account: &Rc<Account<T>>,
    credit_account: &Rc<Account<T>>,
    sum: &Sum<T>,
    meta: T::Move
) -> Rc<Self>
[src]

Creates a new move.

Panics

  • debit_account and credit_account are in different books.
  • debit_account and credit_account are the same.
  • Some Unit in the Sum is not in the same book as the accounts.

pub fn balance_in(
    &self,
    account: &Rc<Account<T>>,
    cmp: impl Fn(&T::Move, &T::Move) -> Ordering
) -> Balance<T>
[src]

Calculates the balance that is the result of this move in an account according to a provided order of moves.

Panics

  • account is not debit nor credit in this move.

Trait Implementations

impl<T: Debug + Metadata> Debug for Move<T> where
    T::Move: Debug
[src]

impl<T: Metadata> Eq for Move<T>[src]

impl<T: Metadata> Ord for Move<T>[src]

impl<T: Metadata> PartialEq<Move<T>> for Move<T>[src]

impl<T: Metadata> PartialOrd<Move<T>> for Move<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Move<T>

impl<T> !Send for Move<T>

impl<T> !Sync for Move<T>

impl<T> Unpin for Move<T> where
    <T as Metadata>::Move: Unpin

impl<T> !UnwindSafe for Move<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.