Skip to main content

Position

Struct Position 

Source
pub struct Position<Rep, T> { /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.2.0
Expand description

Position.

Implementationsยง

Sourceยง

impl<Rep: Representation, T: PositionNum> Position<Rep, T>

Source

pub fn new(price: T, size: T, value: T) -> Option<Self>

๐Ÿ‘ŽDeprecated since 0.2.0

Create a new Position.

Source

pub fn from_naive<H: IntoNaivePosition<T>>(naive: H) -> Option<Self>

๐Ÿ‘ŽDeprecated since 0.2.0

Create a new Position from IntoNaivePosition.

This method will convert the price and size of naive by Rep.

Source

pub fn consumed(&self) -> Option<Self>

๐Ÿ‘ŽDeprecated since 0.2.0

Return a new position that consumes its value. (Equivalence I).

Return None if size is zero.

Source

pub fn consume(&mut self)

๐Ÿ‘ŽDeprecated since 0.2.0

Consume value.

No effect if size is zero.

Source

pub fn converted(&self, price: T) -> Self

๐Ÿ‘ŽDeprecated since 0.2.0

Return a new position with the given price but keep equivalent to the original position. (Equivalence II)

Source

pub fn convert(&mut self, price: T)

๐Ÿ‘ŽDeprecated since 0.2.0

Convert the price to the given but keep equivalent to the original. (Equivalence II)

Source

pub fn price(&self) -> Option<T>

๐Ÿ‘ŽDeprecated since 0.2.0

Price in Rep representation.

Return None if naive price is zero when Rep is reversed.

Source

pub fn size(&self) -> T

๐Ÿ‘ŽDeprecated since 0.2.0

Size in Rep representation.

Source

pub fn value(&self) -> &T

๐Ÿ‘ŽDeprecated since 0.2.0

Value.

Source

pub fn naive_price(&self) -> &T

๐Ÿ‘ŽDeprecated since 0.2.0

Naive price.

Source

pub fn naive_size(&self) -> &T

๐Ÿ‘ŽDeprecated since 0.2.0

Naive size.

Source

pub fn take(&mut self) -> T

๐Ÿ‘ŽDeprecated since 0.2.0

Take the value and keep the price and size unchanged.

After the operation, the new position is no longer equivalent to the original.

Trait Implementationsยง

Sourceยง

impl<Rep: Representation, T: PositionNum> Add for Position<Rep, T>

Sourceยง

type Output = Position<Rep, T>

The resulting type after applying the + operator.
Sourceยง

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum> Clone for Position<Rep, T>

Sourceยง

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum + Debug> Debug for Position<Rep, T>

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum> Default for Position<Rep, T>

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<'de, Rep, T> Deserialize<'de> for Position<Rep, T>
where T: Deserialize<'de>,

Sourceยง

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<Rep: Representation, T: PositionNum + Display> Display for Position<Rep, T>

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum> IntoNaivePosition<T> for Position<Rep, T>

Sourceยง

fn into_naive(self) -> NaivePosition<T>

Convert to a NaivePosition.
Sourceยง

fn reversed(self) -> Reversed<Self>
where Self: Sized,

Mark this position as reversed-form.
Sourceยง

impl<Rep: Representation, T: PositionNum> Neg for Position<Rep, T>

Sourceยง

type Output = Position<Rep, T>

The resulting type after applying the - operator.
Sourceยง

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum> PartialEq for Position<Rep, T>

Sourceยง

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl<Rep, T> Serialize for Position<Rep, T>
where T: Serialize,

Sourceยง

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum> Sub for Position<Rep, T>

Sourceยง

type Output = Position<Rep, T>

The resulting type after applying the - operator.
Sourceยง

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Sourceยง

impl<Rep: Representation, T: PositionNum + Copy> Copy for Position<Rep, T>

Sourceยง

impl<Rep: Representation, T: PositionNum> Eq for Position<Rep, T>

Auto Trait Implementationsยง

ยง

impl<Rep, T> Freeze for Position<Rep, T>
where T: Freeze,

ยง

impl<Rep, T> RefUnwindSafe for Position<Rep, T>

ยง

impl<Rep, T> Send for Position<Rep, T>
where T: Send, Rep: Send,

ยง

impl<Rep, T> Sync for Position<Rep, T>
where T: Sync, Rep: Sync,

ยง

impl<Rep, T> Unpin for Position<Rep, T>
where T: Unpin, Rep: Unpin,

ยง

impl<Rep, T> UnsafeUnpin for Position<Rep, T>
where T: UnsafeUnpin,

ยง

impl<Rep, T> UnwindSafe for Position<Rep, T>
where T: UnwindSafe, Rep: UnwindSafe,

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, H> ToNaivePosition<T> for H

Sourceยง

fn to_naive(&self) -> NaivePosition<T>

Convert to a NaivePosition.
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T> ToString for T
where T: Display + ?Sized,

Sourceยง

fn to_string(&self) -> String

Converts the given value to a String. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,