[−][src]Struct organix::service::ServiceState
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]
F: Future + Send + 'static,
F::Output: Send + 'static,
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,
<T as Service>::IntercomMsg: Send,
impl<T> Sync for ServiceState<T> where
<T as Service>::IntercomMsg: Send,
<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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,