pub struct Executor { /* private fields */ }Expand description
Underlying Ockam node executor
This type is a small wrapper around an inner async runtime (tokio by
default) and the Ockam router. In most cases it is recommended you use the
ockam::node function annotation instead!
Implementations§
source§impl Executor
impl Executor
sourcepub fn new(rt: Arc<Runtime>, flow_controls: &FlowControls) -> Executor
pub fn new(rt: Arc<Runtime>, flow_controls: &FlowControls) -> Executor
Create a new Ockam node Executor instance
sourcepub async fn start_router(&mut self) -> Result<(), Error>
pub async fn start_router(&mut self) -> Result<(), Error>
Start the router asynchronously
sourcepub fn execute<F, T, E>(
&mut self,
future: F
) -> Result<<F as Future>::Output, Error>
pub fn execute<F, T, E>( &mut self, future: F ) -> Result<<F as Future>::Output, Error>
Initialise and run the Ockam node executor context
In this background this launches async execution of the Ockam router, while blocking execution on the provided future.
Any errors encountered by the router or provided application code will be returned from this function.
sourcepub fn execute_no_abort<F, T>(
&mut self,
future: F
) -> Result<<F as Future>::Output, Error>
pub fn execute_no_abort<F, T>( &mut self, future: F ) -> Result<<F as Future>::Output, Error>
Initialise and run the Ockam node executor context
In this background this launches async execution of the Ockam router, while blocking execution on the provided future.
Any errors encountered by the router or provided application code will be returned from this function.
Don’t abort the router in case of a failure
sourcepub fn execute_future<F>(future: F) -> Result<<F as Future>::Output, Error>
pub fn execute_future<F>(future: F) -> Result<<F as Future>::Output, Error>
Execute a future and block until a result is returned This function can only be called to run futures before the Executor has been initialized. Otherwise the Executor rt attribute needs to be accessed to execute or spawn futures
Auto Trait Implementations§
impl Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl !UnwindSafe for Executor
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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