pub struct AssetBalanceOwnedView(/* private fields */);Expand description
Self-contained, 'static owned view of a AssetBalance message.
Wraps ::buffa::OwnedView<AssetBalanceView<'static>>: the decoded view and the ::buffa::bytes::Bytes buffer it borrows from travel together, so the handle is 'static and Send + Sync — suitable for async handlers, spawned tasks, and anywhere a 'static bound is required.
Field accessors return borrows tied to &self. Use Self::view to get the full AssetBalanceView when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.
Implementations§
Source§impl AssetBalanceOwnedView
impl AssetBalanceOwnedView
Sourcepub fn decode(bytes: Bytes) -> Result<Self, DecodeError>
pub fn decode(bytes: Bytes) -> Result<Self, DecodeError>
Decode an owned view from a ::buffa::bytes::Bytes buffer.
The view borrows directly from the buffer’s data; the buffer is retained inside the returned handle.
§Errors
Returns ::buffa::DecodeError if the buffer contains invalid
protobuf data.
Sourcepub fn decode_with_options(
bytes: Bytes,
opts: &DecodeOptions,
) -> Result<Self, DecodeError>
pub fn decode_with_options( bytes: Bytes, opts: &DecodeOptions, ) -> Result<Self, DecodeError>
Decode with custom ::buffa::DecodeOptions (recursion limit,
max message size).
§Errors
Returns ::buffa::DecodeError if the buffer is invalid or
exceeds the configured limits.
Sourcepub fn from_owned(msg: &AssetBalance) -> Result<Self, DecodeError>
pub fn from_owned(msg: &AssetBalance) -> Result<Self, DecodeError>
Build from an owned message via an encode → decode round-trip.
§Errors
Returns ::buffa::DecodeError if the re-encoded bytes are
somehow invalid (should not happen for well-formed messages).
Sourcepub fn view(&self) -> &AssetBalanceView<'_>
pub fn view(&self) -> &AssetBalanceView<'_>
Borrow the full AssetBalanceView with its lifetime tied to &self.
Sourcepub fn to_owned_message(&self) -> Result<AssetBalance, DecodeError>
pub fn to_owned_message(&self) -> Result<AssetBalance, DecodeError>
Convert to the owned message type.
§Errors
Returns an error if re-materializing preserved unknown fields fails (e.g. the unknown-field limit is exceeded).
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume the handle, returning the underlying bytes buffer.
Sourcepub fn asset_id(&self) -> u32
pub fn asset_id(&self) -> u32
Public unified asset id. Resolve symbol from SpotConfig; U128 amounts in this message always use fixed 18-decimal ledger scale.
Field 1: asset_id
Sourcepub fn trading(&self) -> &MessageFieldView<U128View<'_>>
pub fn trading(&self) -> &MessageFieldView<U128View<'_>>
Trading balance at fixed 18-decimal ledger scale.
Field 2: trading
Sourcepub fn funding(&self) -> &MessageFieldView<U128View<'_>>
pub fn funding(&self) -> &MessageFieldView<U128View<'_>>
Funding balance at fixed 18-decimal ledger scale.
Field 3: funding
Sourcepub fn reserved(&self) -> &MessageFieldView<U128View<'_>>
pub fn reserved(&self) -> &MessageFieldView<U128View<'_>>
Reserved amount in the trading bucket at fixed 18-decimal ledger scale.
Field 4: reserved
Sourcepub fn available(&self) -> &MessageFieldView<U128View<'_>>
pub fn available(&self) -> &MessageFieldView<U128View<'_>>
Amount currently available for new trading activity at fixed 18-decimal ledger scale. This value already accounts for active reservations.
Field 5: available
Sourcepub fn trading_revision(&self) -> u64
pub fn trading_revision(&self) -> u64
Opaque monotonic revision for the atomic trading, reserved, and available values. Higher means newer; zero means no trading state has been observed.
Field 6: trading_revision
Sourcepub fn funding_revision(&self) -> u64
pub fn funding_revision(&self) -> u64
Opaque monotonic revision for the funding value. Higher means newer; zero means no funding state has been observed.
Field 7: funding_revision
Trait Implementations§
Source§impl AsRef<OwnedView<AssetBalanceView<'static>>> for AssetBalanceOwnedView
impl AsRef<OwnedView<AssetBalanceView<'static>>> for AssetBalanceOwnedView
Source§fn as_ref(&self) -> &OwnedView<AssetBalanceView<'static>>
fn as_ref(&self) -> &OwnedView<AssetBalanceView<'static>>
Source§impl Clone for AssetBalanceOwnedView
impl Clone for AssetBalanceOwnedView
Source§fn clone(&self) -> AssetBalanceOwnedView
fn clone(&self) -> AssetBalanceOwnedView
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more