[][src]Struct organix::service::ServiceState

pub struct ServiceState<T: Service> { /* fields omitted */ }

this is the object that every services has access to

each service has its own ServiceState. It allows to connect to other services [intercom_with] as well as getting access to the service's settings or state

Implementations

impl<T: Service> ServiceState<T>[src]

pub fn identifier(&self) -> ServiceIdentifier[src]

access the service's Identifier

this is just similar to calling <T as Service>::SERVICE_IDENTIFIER

pub fn intercom_with<O: Service>(&self) -> Intercom<O>[src]

open an Intercom handle with the given service O

pub fn watchdog_controller(&self) -> &WatchdogQuery[src]

access the WatchdogQuery allowing raw command access to all watchdog commands.

pub fn intercom_mut(&mut self) -> &mut IntercomReceiver<T::IntercomMsg>[src]

access the service's IntercomReceiver end

this is the end that will receive intercom messages from other services

pub fn status_reader(&self) -> &StatusReader[src]

access the status reader of the service. If the status is updated to be shutdown then the reader will receive the notification event and will be able to prepare for shutdown gracefully

pub fn runtime_handle(&self) -> &Handle[src]

access the service's Runtime handle

This object can be cloned and send between tasks allowing for other tasks to create their own subtasks and so on

pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> where
    F: Future + Send + 'static,
    F::Output: Send + 'static, 
[src]

spawn the given future in the context of the Service's Runtime.

While there is no way to enforce the users to actually spawn tasks within the Runtime we can at least urge the users to do so and avoid using the global runtime context as it may be used for other purposes.

Auto Trait Implementations

impl<T> !RefUnwindSafe for ServiceState<T>

impl<T> Send for ServiceState<T> where
    <T as Service>::IntercomMsg: Send

impl<T> Sync for ServiceState<T> where
    <T as Service>::IntercomMsg: Send

impl<T> Unpin for ServiceState<T>

impl<T> !UnwindSafe for ServiceState<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]