pub struct Engine<Clock, State, ExecutionTxs, Strategy, Risk> {
pub clock: Clock,
pub meta: EngineMeta,
pub state: State,
pub execution_txs: ExecutionTxs,
pub strategy: Strategy,
pub risk: Risk,
}Expand description
Algorithmic trading Engine.
The Engine:
- Processes input
EngineEvent(or custom events if implemented). - Maintains the internal
EngineState(instrument data state, open orders, positions, etc.). - Generates algo orders (if
TradingState::Enabled).
§Type Parameters
Clock-EngineClockimplementation.State- EngineStateimplementation (eg/EngineState).ExecutionTxs-ExecutionTxMapimplementation for sending execution requests.Strategy- Trading Strategy implementation (seesuper::strategy).Risk-RiskManagerimplementation.
Fields§
§clock: Clock§meta: EngineMeta§state: State§execution_txs: ExecutionTxs§strategy: Strategy§risk: RiskImplementations§
Source§impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>
impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>
Sourcepub fn action(&mut self, command: &Command) -> ActionOutputwhere
InstrumentData: InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
Strategy: ClosePositionsStrategy<State = EngineState<GlobalData, InstrumentData>>,
Risk: RiskManager,
pub fn action(&mut self, command: &Command) -> ActionOutputwhere
InstrumentData: InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
Strategy: ClosePositionsStrategy<State = EngineState<GlobalData, InstrumentData>>,
Risk: RiskManager,
Action an Engine Command, producing an ActionOutput of work done.
Sourcepub fn update_from_trading_state_update(
&mut self,
update: TradingState,
) -> Option<Strategy::OnTradingDisabled>where
Strategy: OnTradingDisabled<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
pub fn update_from_trading_state_update(
&mut self,
update: TradingState,
) -> Option<Strategy::OnTradingDisabled>where
Strategy: OnTradingDisabled<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
Update the Engine TradingState.
If the TradingState transitions to TradingState::Disabled, the Engine will call
the configured OnTradingDisabled strategy logic.
Sourcepub fn update_from_account_stream(
&mut self,
event: &AccountStreamEvent,
) -> UpdateFromAccountOutput<Strategy::OnDisconnect>where
InstrumentData: for<'a> Processor<&'a AccountEvent>,
GlobalData: for<'a> Processor<&'a AccountEvent>,
Strategy: OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
pub fn update_from_account_stream(
&mut self,
event: &AccountStreamEvent,
) -> UpdateFromAccountOutput<Strategy::OnDisconnect>where
InstrumentData: for<'a> Processor<&'a AccountEvent>,
GlobalData: for<'a> Processor<&'a AccountEvent>,
Strategy: OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
Update the Engine from an AccountStreamEvent.
If the input AccountStreamEvent indicates the exchange execution link has disconnected,
the Engine will call the configured OnDisconnectStrategy strategy logic.
Sourcepub fn update_from_market_stream(
&mut self,
event: &MarketStreamEvent<InstrumentIndex, InstrumentData::MarketEventKind>,
) -> UpdateFromMarketOutput<Strategy::OnDisconnect>where
InstrumentData: InstrumentDataState,
GlobalData: for<'a> Processor<&'a MarketEvent<InstrumentIndex, InstrumentData::MarketEventKind>>,
Strategy: OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
pub fn update_from_market_stream(
&mut self,
event: &MarketStreamEvent<InstrumentIndex, InstrumentData::MarketEventKind>,
) -> UpdateFromMarketOutput<Strategy::OnDisconnect>where
InstrumentData: InstrumentDataState,
GlobalData: for<'a> Processor<&'a MarketEvent<InstrumentIndex, InstrumentData::MarketEventKind>>,
Strategy: OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>,
Update the Engine from a MarketStreamEvent.
If the input MarketStreamEvent indicates the exchange market data link has disconnected,
the Engine will call the configured OnDisconnectStrategy strategy logic.
Sourcepub fn trading_summary_generator(
&self,
risk_free_return: Decimal,
) -> TradingSummaryGeneratorwhere
Clock: EngineClock,
pub fn trading_summary_generator(
&self,
risk_free_return: Decimal,
) -> TradingSummaryGeneratorwhere
Clock: EngineClock,
Returns a TradingSummaryGenerator for the current trading session.
Sourcepub fn process_contract_expiry(
&mut self,
key: &InstrumentIndex,
) -> Vec<PositionExited<AssetIndex, InstrumentIndex>>where
Clock: EngineClock,
InstrumentData: InstrumentDataState + InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
pub fn process_contract_expiry(
&mut self,
key: &InstrumentIndex,
) -> Vec<PositionExited<AssetIndex, InstrumentIndex>>where
Clock: EngineClock,
InstrumentData: InstrumentDataState + InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
Processes a ContractExpiry event for the given InstrumentIndex.
§Algorithm
- Guards on
expiration_processed(idempotent). - Cancels all open orders for the instrument by sending
ExecutionRequest::Cancelfor each. - Derives settlement price from instrument data and contract specification:
- OTM: settlement price = 0
- ITM call: settlement = spot - strike (per-contract intrinsic value)
- ITM put: settlement = strike - spot (per-contract intrinsic value)
- Synthesises a closing
Tradeat the settlement price and routes it throughinstrument_state.update_from_trade. - Sets
instrument_state.expiration_processed = true.
If no position is open for the instrument, steps 3–4 are skipped.
If no market price is available, settlement cannot be computed and the method
logs a warning and returns without synthesising a fill. The expiration_processed
flag is not set in this case, making the event retryable — re-inject
ContractExpiry once the underlying spot instrument has received market data.
§Not modelled (deferred)
-
Assignment for short writers: short positions at expiry are closed at intrinsic value identical to long positions (OTM at 0, ITM at
|spot − strike|). True assignment — where the short writer is obligated to deliver the underlying — is not modelled. A future enhancement would detect net-short positions and open a synthetic underlying position instead of (or in addition to) closing the option position. -
Physical settlement: all settlements are cash-equivalent (a synthetic fill at the settlement price adjusts PnL). No separate “deliver/receive underlying” position is opened. Physically-settled contracts (e.g. some futures-style options) are out of scope until this is revisited.
Source§impl<Clock, State, ExecutionTxs, Strategy, Risk> Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock,
impl<Clock, State, ExecutionTxs, Strategy, Risk> Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock,
Sourcepub fn new(
clock: Clock,
state: State,
execution_txs: ExecutionTxs,
strategy: Strategy,
risk: Risk,
) -> Self
pub fn new( clock: Clock, state: State, execution_txs: ExecutionTxs, strategy: Strategy, risk: Risk, ) -> Self
Construct a new Engine.
An initial EngineMeta is constructed form the provided clock and Sequence(0).
Sourcepub fn reset_metadata(&mut self)
pub fn reset_metadata(&mut self)
Reset the internal EngineMeta to the clock time and Sequence(0).
Trait Implementations§
Source§impl<Audit, Clock, State, ExecutionTxs, Strategy, Risk> Auditor<Audit> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock,
State: Clone,
Strategy: OnTradingDisabled<Clock, State, ExecutionTxs, Risk> + OnDisconnectStrategy<Clock, State, ExecutionTxs, Risk>,
impl<Audit, Clock, State, ExecutionTxs, Strategy, Risk> Auditor<Audit> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock,
State: Clone,
Strategy: OnTradingDisabled<Clock, State, ExecutionTxs, Risk> + OnDisconnectStrategy<Clock, State, ExecutionTxs, Risk>,
Source§impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> CancelOrders for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
InstrumentData: InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> CancelOrders for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
InstrumentData: InFlightRequestRecorder,
ExecutionTxs: ExecutionTxMap,
Source§fn cancel_orders(
&mut self,
filter: &InstrumentFilter<ExchangeIndex, AssetIndex, InstrumentIndex>,
) -> SendRequestsOutput<RequestCancel, ExchangeIndex, InstrumentIndex>
fn cancel_orders( &mut self, filter: &InstrumentFilter<ExchangeIndex, AssetIndex, InstrumentIndex>, ) -> SendRequestsOutput<RequestCancel, ExchangeIndex, InstrumentIndex>
Source§impl<Clock: Clone, State: Clone, ExecutionTxs: Clone, Strategy: Clone, Risk: Clone> Clone for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: Clone, State: Clone, ExecutionTxs: Clone, Strategy: Clone, Risk: Clone> Clone for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, AssetKey, InstrumentKey> ClosePositions<ExchangeKey, AssetKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
State: InFlightRequestRecorder<ExchangeKey, InstrumentKey>,
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
Strategy: ClosePositionsStrategy<ExchangeKey, AssetKey, InstrumentKey, State = State>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, AssetKey, InstrumentKey> ClosePositions<ExchangeKey, AssetKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
State: InFlightRequestRecorder<ExchangeKey, InstrumentKey>,
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
Strategy: ClosePositionsStrategy<ExchangeKey, AssetKey, InstrumentKey, State = State>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
Source§fn close_positions(
&mut self,
filter: &InstrumentFilter<ExchangeKey, AssetKey, InstrumentKey>,
) -> SendCancelsAndOpensOutput<ExchangeKey, InstrumentKey>
fn close_positions( &mut self, filter: &InstrumentFilter<ExchangeKey, AssetKey, InstrumentKey>, ) -> SendCancelsAndOpensOutput<ExchangeKey, InstrumentKey>
impl<Clock: Copy, State: Copy, ExecutionTxs: Copy, Strategy: Copy, Risk: Copy> Copy for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock: Debug, State: Debug, ExecutionTxs: Debug, Strategy: Debug, Risk: Debug> Debug for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: Debug, State: Debug, ExecutionTxs: Debug, Strategy: Debug, Risk: Debug> Debug for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: Eq, State: Eq, ExecutionTxs: Eq, Strategy: Eq, Risk: Eq> Eq for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, InstrumentKey> GenerateAlgoOrders<ExchangeKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
State: InFlightRequestRecorder<ExchangeKey, InstrumentKey>,
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
Strategy: AlgoStrategy<ExchangeKey, InstrumentKey, State = State>,
Risk: RiskManager<ExchangeKey, InstrumentKey, State = State>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, InstrumentKey> GenerateAlgoOrders<ExchangeKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
State: InFlightRequestRecorder<ExchangeKey, InstrumentKey>,
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
Strategy: AlgoStrategy<ExchangeKey, InstrumentKey, State = State>,
Risk: RiskManager<ExchangeKey, InstrumentKey, State = State>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
Source§fn generate_algo_orders(
&mut self,
) -> GenerateAlgoOrdersOutput<ExchangeKey, InstrumentKey>
fn generate_algo_orders( &mut self, ) -> GenerateAlgoOrdersOutput<ExchangeKey, InstrumentKey>
Source§impl<Clock: Hash, State: Hash, ExecutionTxs: Hash, Strategy: Hash, Risk: Hash> Hash for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: Hash, State: Hash, ExecutionTxs: Hash, Strategy: Hash, Risk: Hash> Hash for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock: Ord, State: Ord, ExecutionTxs: Ord, Strategy: Ord, Risk: Ord> Ord for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: Ord, State: Ord, ExecutionTxs: Ord, Strategy: Ord, Risk: Ord> Ord for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<Clock: PartialEq, State: PartialEq, ExecutionTxs: PartialEq, Strategy: PartialEq, Risk: PartialEq> PartialEq for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: PartialEq, State: PartialEq, ExecutionTxs: PartialEq, Strategy: PartialEq, Risk: PartialEq> PartialEq for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock: PartialOrd, State: PartialOrd, ExecutionTxs: PartialOrd, Strategy: PartialOrd, Risk: PartialOrd> PartialOrd for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock: PartialOrd, State: PartialOrd, ExecutionTxs: PartialOrd, Strategy: PartialOrd, Risk: PartialOrd> PartialOrd for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§fn partial_cmp(
&self,
other: &Engine<Clock, State, ExecutionTxs, Strategy, Risk>,
) -> Option<Ordering>
fn partial_cmp( &self, other: &Engine<Clock, State, ExecutionTxs, Strategy, Risk>, ) -> Option<Ordering>
Source§impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> Processor<EngineEvent<<InstrumentData as InstrumentDataState>::MarketEventKind>> for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock + for<'a> Processor<&'a EngineEvent<InstrumentData::MarketEventKind>>,
InstrumentData: InstrumentDataState,
GlobalData: for<'a> Processor<&'a AccountEvent> + for<'a> Processor<&'a MarketEvent<InstrumentIndex, InstrumentData::MarketEventKind>>,
ExecutionTxs: ExecutionTxMap<ExchangeIndex, InstrumentIndex>,
Strategy: OnTradingDisabled<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk> + OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk> + AlgoStrategy<State = EngineState<GlobalData, InstrumentData>> + ClosePositionsStrategy<State = EngineState<GlobalData, InstrumentData>>,
Risk: RiskManager<State = EngineState<GlobalData, InstrumentData>>,
impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> Processor<EngineEvent<<InstrumentData as InstrumentDataState>::MarketEventKind>> for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
Clock: EngineClock + for<'a> Processor<&'a EngineEvent<InstrumentData::MarketEventKind>>,
InstrumentData: InstrumentDataState,
GlobalData: for<'a> Processor<&'a AccountEvent> + for<'a> Processor<&'a MarketEvent<InstrumentIndex, InstrumentData::MarketEventKind>>,
ExecutionTxs: ExecutionTxMap<ExchangeIndex, InstrumentIndex>,
Strategy: OnTradingDisabled<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk> + OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk> + AlgoStrategy<State = EngineState<GlobalData, InstrumentData>> + ClosePositionsStrategy<State = EngineState<GlobalData, InstrumentData>>,
Risk: RiskManager<State = EngineState<GlobalData, InstrumentData>>,
type Audit = EngineAudit<EngineEvent<<InstrumentData as InstrumentDataState>::MarketEventKind>, EngineOutput<<Strategy as OnTradingDisabled<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>>::OnTradingDisabled, <Strategy as OnDisconnectStrategy<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Risk>>::OnDisconnect>>
fn process( &mut self, event: EngineEvent<InstrumentData::MarketEventKind>, ) -> Self::Audit
Source§impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, InstrumentKey> SendRequests<ExchangeKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
impl<Clock, State, ExecutionTxs, Strategy, Risk, ExchangeKey, InstrumentKey> SendRequests<ExchangeKey, InstrumentKey> for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
ExecutionTxs: ExecutionTxMap<ExchangeKey, InstrumentKey>,
ExchangeKey: Debug + Clone,
InstrumentKey: Debug + Clone,
fn send_requests<Kind>(
&self,
requests: impl IntoIterator<Item = OrderEvent<Kind, ExchangeKey, InstrumentKey>>,
) -> SendRequestsOutput<Kind, ExchangeKey, InstrumentKey>where
Kind: Debug + Clone,
ExecutionRequest<ExchangeKey, InstrumentKey>: From<OrderEvent<Kind, ExchangeKey, InstrumentKey>>,
fn send_request<Kind>(
&self,
request: &OrderEvent<Kind, ExchangeKey, InstrumentKey>,
) -> Result<(), EngineError>where
Kind: Debug + Clone,
ExecutionRequest<ExchangeKey, InstrumentKey>: From<OrderEvent<Kind, ExchangeKey, InstrumentKey>>,
impl<Clock: PartialEq, State: PartialEq, ExecutionTxs: PartialEq, Strategy: PartialEq, Risk: PartialEq> StructuralPartialEq for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
Source§impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> SyncShutdown for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
ExecutionTxs: ExecutionTxMap,
impl<Clock, GlobalData, InstrumentData, ExecutionTxs, Strategy, Risk> SyncShutdown for Engine<Clock, EngineState<GlobalData, InstrumentData>, ExecutionTxs, Strategy, Risk>where
ExecutionTxs: ExecutionTxMap,
Auto Trait Implementations§
impl<Clock, State, ExecutionTxs, Strategy, Risk> Freeze for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock, State, ExecutionTxs, Strategy, Risk> RefUnwindSafe for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: RefUnwindSafe,
State: RefUnwindSafe,
ExecutionTxs: RefUnwindSafe,
Strategy: RefUnwindSafe,
Risk: RefUnwindSafe,
impl<Clock, State, ExecutionTxs, Strategy, Risk> Send for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock, State, ExecutionTxs, Strategy, Risk> Sync for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock, State, ExecutionTxs, Strategy, Risk> Unpin for Engine<Clock, State, ExecutionTxs, Strategy, Risk>
impl<Clock, State, ExecutionTxs, Strategy, Risk> UnsafeUnpin for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: UnsafeUnpin,
State: UnsafeUnpin,
ExecutionTxs: UnsafeUnpin,
Strategy: UnsafeUnpin,
Risk: UnsafeUnpin,
impl<Clock, State, ExecutionTxs, Strategy, Risk> UnwindSafe for Engine<Clock, State, ExecutionTxs, Strategy, Risk>where
Clock: UnwindSafe,
State: UnwindSafe,
ExecutionTxs: UnwindSafe,
Strategy: UnwindSafe,
Risk: UnwindSafe,
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more