Struct Runtime
pub struct Runtime { /* private fields */ }std only.Expand description
A cloneable, continuously driven Tokio runtime for blocking API boundaries.
Implementations§
§impl Runtime
impl Runtime
pub fn builder() -> RuntimeBuilder
pub fn builder() -> RuntimeBuilder
Create a RuntimeBuilder.
pub fn handle(&self) -> OwnedRuntimeHandle
pub fn handle(&self) -> OwnedRuntimeHandle
Return a cloneable handle targeting this runtime and telemetry session.
pub fn flavor(&self) -> RuntimeFlavor
pub fn flavor(&self) -> RuntimeFlavor
Return the scheduler flavor backing this runtime.
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 future to completion, blocking the calling thread.
This directly drives the future and does not create a dial9-tracked
task. Prefer block_on_task for owned work.
§Panics
Panics when Tokio rejects synchronously driving the runtime, such as
directly from an asynchronous task executor thread. It can be called
from ordinary synchronous threads, [tokio::task::spawn_blocking], and
[tokio::task::block_in_place].
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 as a task on this runtime and block until it completes.
This is the preferred entry point for blocking boundaries. With
dial9 enabled, the task is routed through the runtime’s telemetry
handle so wake tracking and Rama protocol events are preserved.
§Panics
Panics when Tokio rejects synchronously driving the runtime, such as
directly from an asynchronous task executor thread. It can be called
from ordinary synchronous threads, [tokio::task::spawn_blocking], and
[tokio::task::block_in_place].
pub fn with_context<T>(&self, f: impl FnOnce() -> T) -> T
pub fn with_context<T>(&self, f: impl FnOnce() -> T) -> T
Enter this runtime while synchronously constructing a runtime-bound value.
This is primarily intended for protocol wrappers whose constructors
synchronously call tokio::spawn.
Work spawned directly by the closure only has Tokio context. Use
OwnedRuntimeHandle::spawn through handle for tasks
that must retain dial9 tracking.
pub fn service<S>(&self, service: S) -> Service<S>
pub fn service<S>(&self, service: S) -> Service<S>
Wrap an asynchronous Rama service in a blocking boundary.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Runtime
impl !UnwindSafe for Runtime
impl Freeze for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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