Struct jormungandr::utils::task::TokioServiceInfo
source · pub struct TokioServiceInfo {
name: &'static str,
up_time: Instant,
span: Span,
handle: Handle,
}
Expand description
the current future service information
retrieve the name, the up time, the tracing span and the handle
Fields§
§name: &'static str
§up_time: Instant
§span: Span
§handle: Handle
Implementations§
source§impl TokioServiceInfo
impl TokioServiceInfo
sourcepub fn runtime_handle(&self) -> &Handle
pub fn runtime_handle(&self) -> &Handle
Access the service’s handle
sourcepub fn spawn<F>(&self, name: &'static str, future: F)where
F: Future<Output = ()> + Send + 'static,
pub fn spawn<F>(&self, name: &'static str, future: F)where F: Future<Output = ()> + Send + 'static,
spawn a std::future within the service’s tokio handle
sourcepub fn spawn_fallible<F, E>(&self, name: &'static str, future: F)where
F: Send + 'static + Future<Output = Result<(), E>>,
E: Debug,
pub fn spawn_fallible<F, E>(&self, name: &'static str, future: F)where F: Send + 'static + Future<Output = Result<(), E>>, E: Debug,
just like spawn but instead log an error on Result::Err
sourcepub fn timeout_spawn<F>(&self, name: &'static str, timeout: Duration, future: F)where
F: Future<Output = ()> + Send + 'static,
pub fn timeout_spawn<F>(&self, name: &'static str, timeout: Duration, future: F)where F: Future<Output = ()> + Send + 'static,
just like spawn but add a timeout
sourcepub fn timeout_spawn_fallible<F, E>(
&self,
name: &'static str,
timeout: Duration,
future: F
)where
F: Send + 'static + Future<Output = Result<(), E>>,
E: Debug,
pub fn timeout_spawn_fallible<F, E>( &self, name: &'static str, timeout: Duration, future: F )where F: Send + 'static + Future<Output = Result<(), E>>, E: Debug,
just like spawn_failable but add a timeout
pub fn run_periodic<F, U>(&self, name: &'static str, period: Duration, f: F)where F: FnMut() -> U + Send + 'static, U: Future<Output = ()> + Send + 'static,
pub fn run_periodic_fallible<F, U, E>( &self, name: &'static str, period: Duration, f: F )where F: FnMut() -> U + Send + 'static, E: Debug, U: Future<Output = Result<(), E>> + Send + 'static,
Auto Trait Implementations§
impl !RefUnwindSafe for TokioServiceInfo
impl Send for TokioServiceInfo
impl Sync for TokioServiceInfo
impl Unpin for TokioServiceInfo
impl !UnwindSafe for TokioServiceInfo
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request