#[non_exhaustive]pub struct UserState {
pub token_to_state: Vec<(u32, Position)>,
pub health: String,
pub health_factor: Option<Figure>,
}Expand description
An account’s lending: a position per token it ever touched, and its health.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.token_to_state: Vec<(u32, Position)>[token index, position] pairs; zero rows stay listed.
health: StringThe venue’s word: healthy, atRisk (seen live on a portfolio-margin
account), or liquidatable.
health_factor: Option<Figure>null while nothing is borrowed.
Implementations§
Source§impl UserState
impl UserState
Sourcepub fn position(&self, token: u32) -> Option<&Position>
pub fn position(&self, token: u32) -> Option<&Position>
The position in token; None when the account never touched it.
Sourcepub fn positions(&self) -> impl Iterator<Item = (u32, &Position)>
pub fn positions(&self) -> impl Iterator<Item = (u32, &Position)>
The positions that hold or owe anything.
Sourcepub fn supplied(&self, token: u32) -> Dec
pub fn supplied(&self, token: u32) -> Dec
What is supplied of token now, interest in; zero for none.
Sourcepub fn borrowed(&self, token: u32) -> Dec
pub fn borrowed(&self, token: u32) -> Dec
What is owed of token now, interest in; zero for none.
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Whether the venue says healthy.
Sourcepub fn risk(&self) -> Risk
pub fn risk(&self) -> Risk
The venue’s word as a Risk: any word other than healthy or
liquidatable reads as Risk::Near.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UserState
impl<'de> Deserialize<'de> for UserState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for UserState
impl StructuralPartialEq for UserState
Auto Trait Implementations§
impl Forget for UserState
impl Freeze for UserState
impl Move for UserState
impl RefUnwindSafe for UserState
impl Send for UserState
impl Sync for UserState
impl Unpin for UserState
impl UnsafeUnpin for UserState
impl UnwindSafe for UserState
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
key and return true if they are equal.