pub enum TwapStartTime {
AtMiningTime,
At(u32),
}Expand description
Start time specification for a TWAP order.
Variants§
AtMiningTime
Start immediately at the block containing the order creation tx.
At(u32)
Start at a specific Unix timestamp.
Implementations§
Source§impl TwapStartTime
impl TwapStartTime
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Returns a human-readable string label for the start time.
§Returns
"at-mining-time" for AtMiningTime, or
"at-unix" for At.
Sourcepub const fn is_at_mining_time(self) -> bool
pub const fn is_at_mining_time(self) -> bool
Returns true if the order starts at the block it is mined in.
§Returns
true for AtMiningTime, false for At.
Sourcepub const fn is_fixed(self) -> bool
pub const fn is_fixed(self) -> bool
Returns true if the order starts at a fixed Unix timestamp.
§Returns
true for At, false for AtMiningTime.
Sourcepub const fn timestamp(self) -> Option<u32>
pub const fn timestamp(self) -> Option<u32>
Return the fixed start timestamp, or None for AtMiningTime.
§Returns
Some(ts) containing the Unix timestamp for At,
or None for AtMiningTime.
Trait Implementations§
Source§impl Clone for TwapStartTime
impl Clone for TwapStartTime
Source§fn clone(&self) -> TwapStartTime
fn clone(&self) -> TwapStartTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TwapStartTime
impl Debug for TwapStartTime
Source§impl<'de> Deserialize<'de> for TwapStartTime
impl<'de> Deserialize<'de> for TwapStartTime
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>,
Source§impl Display for TwapStartTime
impl Display for TwapStartTime
Source§impl From<Option<u32>> for TwapStartTime
impl From<Option<u32>> for TwapStartTime
Source§fn from(ts: Option<u32>) -> Self
fn from(ts: Option<u32>) -> Self
Convert an optional Unix timestamp to a TwapStartTime.
Some(ts) maps to TwapStartTime::At;
None maps to TwapStartTime::AtMiningTime.
Source§impl From<TwapStartTime> for u32
impl From<TwapStartTime> for u32
Source§fn from(t: TwapStartTime) -> Self
fn from(t: TwapStartTime) -> Self
Encode a TwapStartTime as the on-chain t0 field.
TwapStartTime::AtMiningTime encodes as 0; TwapStartTime::At
encodes as the contained Unix timestamp.
Source§impl From<u32> for TwapStartTime
impl From<u32> for TwapStartTime
Source§fn from(ts: u32) -> Self
fn from(ts: u32) -> Self
Convert a Unix timestamp into a TwapStartTime.
0 maps to TwapStartTime::AtMiningTime; any other value maps to
TwapStartTime::At. This mirrors the on-chain t0 field encoding.
Source§impl PartialEq for TwapStartTime
impl PartialEq for TwapStartTime
Source§impl Serialize for TwapStartTime
impl Serialize for TwapStartTime
impl Copy for TwapStartTime
impl Eq for TwapStartTime
impl StructuralPartialEq for TwapStartTime
Auto Trait Implementations§
impl Freeze for TwapStartTime
impl RefUnwindSafe for TwapStartTime
impl Send for TwapStartTime
impl Sync for TwapStartTime
impl Unpin for TwapStartTime
impl UnsafeUnpin for TwapStartTime
impl UnwindSafe for TwapStartTime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.