pub struct Asset(/* private fields */);Expand description
An asset id. Made from the index it is counted from, so a pair index is never sent where an asset id belongs; an index past its range is refused rather than spilling into the next kind’s ids.
Implementations§
Source§impl Asset
impl Asset
Sourcepub const fn from_id(id: u32) -> Asset
pub const fn from_id(id: u32) -> Asset
An id as the venue wrote it, in an order status or a fill.
pub const fn id(self) -> u32
pub const fn kind(self) -> AssetKind
Sourcepub const fn perp(index: u32) -> Option<Asset>
pub const fn perp(index: u32) -> Option<Asset>
A perp on the main dex, by its index in meta.universe.
Sourcepub const fn spot(pair: u32) -> Option<Asset>
pub const fn spot(pair: u32) -> Option<Asset>
A spot pair, by the pair’s own index in spotMeta.universe, which
is not a token’s index.
Sourcepub const fn hip3(dex: u32, index: u32) -> Option<Asset>
pub const fn hip3(dex: u32, index: u32) -> Option<Asset>
A perp on a HIP-3 dex: dex its place in perpDexs (1 or more; the
main dex at 0 is Asset::perp), index its place in that dex’s
meta.universe.
Sourcepub const fn hip3_parts(self) -> Option<(u32, u32)>
pub const fn hip3_parts(self) -> Option<(u32, u32)>
A HIP-3 perp’s dex place in perpDexs and its index in that dex’s
meta: Asset::hip3 taken apart. None for any other kind of id.
Sourcepub const fn perp_on(dex: u32, index: u32) -> Option<Asset>
pub const fn perp_on(dex: u32, index: u32) -> Option<Asset>
A perp by its dex’s place in perpDexs: the main dex at 0, else HIP-3.
Sourcepub const fn outcome(outcome: u32, side: OutcomeSide) -> Option<Asset>
pub const fn outcome(outcome: u32, side: OutcomeSide) -> Option<Asset>
A HIP-4 outcome side: 100000000 + 10 * outcome + side.
Sourcepub const fn outcome_side(self) -> Option<(u32, OutcomeSide)>
pub const fn outcome_side(self) -> Option<(u32, OutcomeSide)>
The outcome and side an outcome id names; None for any other kind.
Trait Implementations§
impl Copy for Asset
impl Eq for Asset
Source§impl Ord for Asset
impl Ord for Asset
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Asset
impl PartialOrd for Asset
impl StructuralPartialEq for Asset
Auto Trait Implementations§
impl Freeze for Asset
impl RefUnwindSafe for Asset
impl Send for Asset
impl Sync for Asset
impl Unpin for Asset
impl UnsafeUnpin for Asset
impl UnwindSafe for Asset
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.