Struct OwnedRuntime
pub struct OwnedRuntime { /* private fields */ }std only.Expand description
An owned Tokio runtime with an optional dial9 telemetry session.
This type centralizes runtime access for components that own their runtime.
Use block_on_task and spawn for
owned work that should participate in dial9 task tracking. The borrowed
block_on variant exists for construction futures that
cannot be 'static.
Implementations§
§impl OwnedRuntime
impl OwnedRuntime
pub fn from_tokio(runtime: Runtime) -> OwnedRuntime
pub fn from_tokio(runtime: Runtime) -> OwnedRuntime
Wrap a Tokio runtime.
pub fn from_dial9(runtime: TracedRuntime) -> OwnedRuntime
Available on crate feature dial9 only.
pub fn from_dial9(runtime: TracedRuntime) -> OwnedRuntime
dial9 only.Wrap a dial9 traced runtime and retain its telemetry guard.
pub fn handle(&self) -> OwnedRuntimeHandle
pub fn handle(&self) -> OwnedRuntimeHandle
Return a cloneable handle targeting this runtime and telemetry session.
The handle does not keep this runtime alive.
pub fn enter(&self) -> EnterGuard<'_>
pub fn enter(&self) -> EnterGuard<'_>
Enter the underlying Tokio runtime on the calling thread.
pub fn block_on<F>(&self, future: F) -> <F as Future>::Outputwhere
F: Future,
pub fn block_on<F>(&self, future: F) -> <F as Future>::Outputwhere
F: Future,
Run a possibly borrowed future to completion.
This directly drives Tokio and does not create a dial9-tracked task.
Prefer block_on_task for owned work.
pub fn block_on_task<F>(&self, future: F) -> <F as Future>::Output
pub fn block_on_task<F>(&self, future: F) -> <F as Future>::Output
Run an owned future to completion as a task on this runtime.
With dial9 enabled, this routes through the runtime’s exact telemetry
handle so wake tracking remains active. Rama protocol events that use
dial9’s ambient handle require a multi-thread Tokio runtime.
pub fn spawn<F>(&self, future: F) -> JoinHandle<<F as Future>::Output> ⓘ
pub fn spawn<F>(&self, future: F) -> JoinHandle<<F as Future>::Output> ⓘ
Spawn an owned future on this runtime.
pub fn shutdown_bounded(self, grace: Duration)
pub fn shutdown_bounded(self, grace: Duration)
Dispose of the runtime without blocking the caller indefinitely.
Tokio supports a bounded consuming shutdown directly. dial9’s traced
runtime does not currently expose one, so its drop is isolated on a
reaper thread and awaited for at most grace.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for OwnedRuntime
impl !RefUnwindSafe for OwnedRuntime
impl !UnwindSafe for OwnedRuntime
impl Send for OwnedRuntime
impl Sync for OwnedRuntime
impl Unpin for OwnedRuntime
impl UnsafeUnpin for OwnedRuntime
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§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> 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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more