pub struct AsyncRunner { /* private fields */ }Implementations§
Source§impl AsyncRunner
impl AsyncRunner
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new AsyncRunner instance.
Creates channels but does not bind senders to thread-local storage.
Call bind_senders before creating clients that
read from TLS, and again before entering the event loop.
Sourcepub fn bind_senders(&self)
pub fn bind_senders(&self)
Binds this runner’s channel senders to thread-local storage.
Call before creating clients that read from TLS (e.g., in the builder), and again before entering the event loop to reclaim ownership if another runner was constructed on this thread in the interim.
Sourcepub fn handle(&self) -> AsyncRunnerHandle
pub fn handle(&self) -> AsyncRunnerHandle
Returns a handle that can be used to stop the runner from another context.
Sourcepub fn take_channels(self) -> AsyncRunnerChannels
pub fn take_channels(self) -> AsyncRunnerChannels
Consumes the runner and returns the channel receivers for direct event loop driving.
This is used when the event loop needs to run on the same thread as the msgbus endpoints (which use thread-local storage).
Sourcepub fn flush_pending_data(&mut self)
pub fn flush_pending_data(&mut self)
Flushes all pending data events and commands from the channels.
Loops until both data channels are empty, processing each item
into the cache immediately. Used in start() where channels are
not extracted.
Sourcepub async fn run(&mut self) -> Result<()>
pub async fn run(&mut self) -> Result<()>
Runs the async runner event loop.
This method processes time, system, execution, and data events in an async loop. It will run until a signal is received or the event streams are closed.
§Errors
Returns a callback dispatch failure, retaining pending channel messages and the failure latch.
Sourcepub fn handle_time_event(message: DispatchMessage<TimeEventMessage>) -> bool
pub fn handle_time_event(message: DispatchMessage<TimeEventMessage>) -> bool
Handles a time event under its originating callback root.
§Panics
Panics if a rooted message is processed outside its owner thread.
Sourcepub fn handle_data_command(cmd: DispatchMessage<DataCommand>)
pub fn handle_data_command(cmd: DispatchMessage<DataCommand>)
Handles a data command under its captured callback root by sending to the DataEngine.
§Panics
Panics if a rooted command is processed outside its owner thread.
Sourcepub fn dispatch_data_event(event: DispatchMessage<DataEvent>)
pub fn dispatch_data_event(event: DispatchMessage<DataEvent>)
Dispatches a received data event under its originating callback root.
§Panics
Panics if a rooted message is processed outside its owner thread.
Sourcepub fn dispatch_exec_event(event: DispatchMessage<ExecutionEvent>)
pub fn dispatch_exec_event(event: DispatchMessage<ExecutionEvent>)
Dispatches a received execution event under its originating callback root.
§Panics
Panics if a rooted message is processed outside its owner thread.
Sourcepub fn handle_data_event(event: DataEvent)
pub fn handle_data_event(event: DataEvent)
Handles a data event by sending to the appropriate DataEngine endpoint.
Sourcepub fn handle_exec_command(cmd: TradingCommand)
pub fn handle_exec_command(cmd: TradingCommand)
Dispatches an internal execution command directly to the execution engine.
Sourcepub fn handle_trading_command(message: DispatchMessage<TradingCommandMessage>)
pub fn handle_trading_command(message: DispatchMessage<TradingCommandMessage>)
Dispatches a trading command and its deferred children under their captured callback roots.
§Panics
Panics if a rooted command is processed outside its owner thread.
Sourcepub fn handle_exec_event(event: ExecutionEvent)
pub fn handle_exec_event(event: ExecutionEvent)
Handles an execution event by sending to the appropriate engine endpoint.
pub fn handle_exec_report(report: ExecutionReport)
Trait Implementations§
Source§impl Debug for AsyncRunner
impl Debug for AsyncRunner
Auto Trait Implementations§
impl Freeze for AsyncRunner
impl RefUnwindSafe for AsyncRunner
impl Send for AsyncRunner
impl Sync for AsyncRunner
impl Unpin for AsyncRunner
impl UnsafeUnpin for AsyncRunner
impl UnwindSafe for AsyncRunner
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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