Struct brb_dt_at2::bank::Bank [−][src]
AT2 Bank
for a particular Actor
Implementations
impl<A: Ord + Hash + Debug + Clone> Bank<A>
[src]
pub fn open_account(&self, owner: A, balance: Money) -> Op<A>
[src]
Open a new account.
The balance field should normally be 0, but this field enables an application to force a non-zero starting balance. Though of course other nodes must agree. This could for example be used to pre-fund a “MINT” account that spends money into existence (in other accounts) over time.
pub fn initial_balance(&self, actor: &A) -> Money
[src]
Returns an account’s starting balance, prior to any transfers in or out.
pub fn balance(&self, actor: &A) -> Money
[src]
Returns an account’s present balance.
This is presently a slow operation as the entire history of all transfers is iterated. i.e., it degrades O(n) with the size of the history.
pub fn transfer(&self, from: A, to: A, amount: Money) -> Option<Op<A>>
[src]
Generates a new Transfer operation (but does not apply it)
Trait Implementations
impl<A: Ord + Hash + Debug + Clone + 'static + Serialize> BRBDataType<A> for Bank<A>
[src]
type Op = Op<A>
The set of ops this data type accepts
type ValidationError = ValidationError
A validation error specific to this data type.
fn new(id: A) -> Self
[src]
fn validate(
&self,
source: &A,
op: &Self::Op
) -> Result<(), Self::ValidationError>
[src]
&self,
source: &A,
op: &Self::Op
) -> Result<(), Self::ValidationError>
Protection against Byzantines
fn apply(&mut self, op: Self::Op)
[src]
Executed once an op has been validated
impl<A: Clone + Ord + Hash> Clone for Bank<A>
[src]
impl<A: Debug + Ord + Hash> Debug for Bank<A>
[src]
impl<A: Eq + Ord + Hash> Eq for Bank<A>
[src]
impl<A: PartialEq + Ord + Hash> PartialEq<Bank<A>> for Bank<A>
[src]
impl<A: Ord + Hash> StructuralEq for Bank<A>
[src]
impl<A: Ord + Hash> StructuralPartialEq for Bank<A>
[src]
Auto Trait Implementations
impl<A> RefUnwindSafe for Bank<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<A> Send for Bank<A> where
A: Send,
A: Send,
impl<A> Sync for Bank<A> where
A: Sync,
A: Sync,
impl<A> Unpin for Bank<A> where
A: Unpin,
A: Unpin,
impl<A> UnwindSafe for Bank<A> where
A: RefUnwindSafe + UnwindSafe,
A: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BRBDT for T where
T: BRBDataType<Actor>,
[src]
T: BRBDataType<Actor>,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,