#[non_exhaustive]#[repr(u8)]pub enum Action {
Buy = 0,
Sell = 1,
Other = 2,
}Expand description
Represents trading actions in a financial context.
Defines the fundamental trade operations that can be performed in a trading system. These actions represent the direction of a trade transaction.
§Stability
This enum is #[non_exhaustive]. New trading actions may be added in
minor releases without a major version bump. Downstream match
expressions must include a wildcard arm (_ =>).
§Examples
use financial_types::Action;
let action = Action::Buy;
assert!(action.is_buy());
assert_eq!(format!("{action}"), "Buy");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Buy = 0
Represents a purchase transaction, where assets are acquired.
Sell = 1
Represents a selling transaction, where assets are disposed of.
Other = 2
Action is not applicable to this type of transaction.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
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
Source§impl Ord for Action
impl Ord for Action
Source§impl PartialOrd for Action
impl PartialOrd for Action
impl Copy for Action
impl Eq for Action
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
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