fuel_core_services

Struct ServiceRunner

source
pub struct ServiceRunner<S>
where S: RunnableService + 'static,
{ pub shared: S::SharedData, /* private fields */ }
Expand description

The service runner manages the lifecycle, execution and error handling of a RunnableService. It can be cloned and passed between threads.

Fields§

§shared: S::SharedData

The shared state of the service

Implementations§

source§

impl<S> ServiceRunner<S>
where S: RunnableService + 'static, S::TaskParams: Default,

source

pub fn new(service: S) -> Self

Initializes a new ServiceRunner containing a RunnableService

source§

impl<S> ServiceRunner<S>
where S: RunnableService + 'static,

source

pub fn new_with_params(service: S, params: S::TaskParams) -> Self

Initializes a new ServiceRunner containing a RunnableService with parameters for underlying Task

Trait Implementations§

source§

impl<S> Debug for ServiceRunner<S>
where S: RunnableService + 'static + Debug, S::SharedData: Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<S> Drop for ServiceRunner<S>
where S: RunnableService + 'static,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<S> Service for ServiceRunner<S>
where S: RunnableService + 'static,

source§

fn start(&self) -> Result<()>

Send a start signal to the service without waiting for it to start. Returns an error if the service was already started.
source§

fn start_and_await<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<State>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a start signal to the service and wait for it to start up. Returns an error if the service was already started.
source§

fn await_start_or_stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<State>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait for service to start or stop (without sending any signal).
source§

fn stop(&self) -> bool

Send a stop signal to the service without waiting for it to shutdown. Returns false if the service was already stopped, true if it is running.
source§

fn stop_and_await<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<State>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send stop signal to service and wait for it to shutdown.
source§

fn await_stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<State>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Wait for service to stop (without sending a stop signal).
source§

fn state(&self) -> State

The current state of the service (i.e. Started, Stopped, etc..)
source§

fn state_watcher(&self) -> StateWatcher

Returns the state watcher of the service.

Auto Trait Implementations§

§

impl<S> Freeze for ServiceRunner<S>

§

impl<S> !RefUnwindSafe for ServiceRunner<S>

§

impl<S> Send for ServiceRunner<S>

§

impl<S> Sync for ServiceRunner<S>

§

impl<S> Unpin for ServiceRunner<S>

§

impl<S> !UnwindSafe for ServiceRunner<S>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more