pub struct Balance { /* private fields */ }Expand description
Holds the balance of an address.
Implementations§
Source§impl Balance
impl Balance
Sourcepub fn new(
amount: u64,
dust_allowance: u64,
dust_outputs: u64,
) -> Result<Self, Error>
pub fn new( amount: u64, dust_allowance: u64, dust_outputs: u64, ) -> Result<Self, Error>
Creates a new Balance.
Sourcepub fn dust_allowance(&self) -> u64
pub fn dust_allowance(&self) -> u64
Returns the dust allowance of the Balance.
Sourcepub fn dust_outputs(&self) -> u64
pub fn dust_outputs(&self) -> u64
Returns the number of dust outputs of the Balance.
Sourcepub fn dust_allowed(&self) -> bool
pub fn dust_allowed(&self) -> bool
Returns whether more dust is allowed on the Balance.
Sourcepub fn apply_diff(self, diff: &BalanceDiff) -> Result<Self, Error>
pub fn apply_diff(self, diff: &BalanceDiff) -> Result<Self, Error>
Safely applies a BalanceDiff to the Balance.
Trait Implementations§
Source§impl Packable for Balance
impl Packable for Balance
Source§fn packed_len(&self) -> usize
fn packed_len(&self) -> usize
Returns the length of the packed bytes.
Source§fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>
Packs the instance to bytes and writes them to the passed writer.
Source§fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R,
) -> Result<Self, Self::Error>
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>( reader: &mut R, ) -> Result<Self, Self::Error>
Reads bytes from the passed reader and unpacks them into an instance.
Source§fn pack_new(&self) -> Vec<u8> ⓘ
fn pack_new(&self) -> Vec<u8> ⓘ
Packs the instance to bytes and writes them to a newly allocated vector.
impl Eq for Balance
impl StructuralPartialEq for Balance
Auto Trait Implementations§
impl Freeze for Balance
impl RefUnwindSafe for Balance
impl Send for Balance
impl Sync for Balance
impl Unpin for Balance
impl UnwindSafe for Balance
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