pub struct Symbol(/* private fields */);Expand description
Symbol.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub const SPOT_PREFIX: SmolStr
pub const SPOT_PREFIX: SmolStr
Empty str, the prefix of spot instruments.
Sourcepub fn is_derivative(&self) -> bool
pub fn is_derivative(&self) -> bool
Is a derivative.
Sourcepub fn as_derivative(&self) -> Option<(&str, &str)>
pub fn as_derivative(&self) -> Option<(&str, &str)>
Get the prefix and the symbol of the derivative.
Return None if it is not a derivative.
Sourcepub fn derivative_prefix(&self) -> Option<&str>
pub fn derivative_prefix(&self) -> Option<&str>
Get the prefix of the derivative. Spots has no prefix.
Sourcepub fn derivative_symbol(&self) -> Option<&str>
pub fn derivative_symbol(&self) -> Option<&str>
Get the symbol of the derivative.
Return None if it is not a derivative.
Sourcepub fn as_spot(&self) -> Option<(&Asset, &Asset)>
pub fn as_spot(&self) -> Option<(&Asset, &Asset)>
As a pair of assets.
Return None if it is not a spot.
Sourcepub fn to_reversed_symbol(&self) -> Option<Symbol>
pub fn to_reversed_symbol(&self) -> Option<Symbol>
Get the reversed spot.
Return None if it is not a spot.
Sourcepub fn derivative(
prefix: &str,
symbol: &str,
) -> Result<Symbol, ParseSymbolError>
pub fn derivative( prefix: &str, symbol: &str, ) -> Result<Symbol, ParseSymbolError>
Create a derivative symbol.
Return ParseSymbolError if the prefix is not valid.
Trait Implementations§
Source§impl AsRef<Symbol> for Instrument
impl AsRef<Symbol> for Instrument
Source§impl<'a> Borrow<Symbol> for &'a Instrument
impl<'a> Borrow<Symbol> for &'a Instrument
Source§impl Borrow<Symbol> for Instrument
impl Borrow<Symbol> for Instrument
Source§impl<'de> Deserialize<'de> for Symbol
impl<'de> Deserialize<'de> for Symbol
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Symbol, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Symbol, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Symbol
impl Ord for Symbol
Source§impl PartialEq<Symbol> for Instrument
impl PartialEq<Symbol> for Instrument
Source§impl PartialOrd for Symbol
impl PartialOrd for Symbol
Source§impl Serialize for Symbol
impl Serialize for Symbol
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more