pub enum Side {
Buy,
Sell,
}Expand description
Represents the side of a trade or order.
This enum is Copy and intended to behave like a small value type.
It does not encode numeric meaning implicitly — use methods like
Side::sign if a signed representation is needed.
Variants§
Implementations§
Source§impl Side
impl Side
Sourcepub fn is_sell(self) -> bool
pub fn is_sell(self) -> bool
Returns true if the side is Side::Sell.
Sourcepub fn opposite(self) -> Self
pub fn opposite(self) -> Self
Returns the opposite trading side.
§Examples
use openpit::param::Side;
assert_eq!(Side::Buy.opposite(), Side::Sell);
assert_eq!(Side::Sell.opposite(), Side::Buy);Sourcepub fn sign(self) -> i8
pub fn sign(self) -> i8
Returns a signed representation of the side.
+1 for Side::Buy, -1 for Side::Sell.
Intended for financial calculations (e.g., signed quantity or exposure).
Trait Implementations§
impl Copy for Side
impl Eq for Side
impl StructuralPartialEq for Side
Auto Trait Implementations§
impl Freeze for Side
impl RefUnwindSafe for Side
impl Send for Side
impl Sync for Side
impl Unpin for Side
impl UnsafeUnpin for Side
impl UnwindSafe for Side
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