Struct DefaultRuntimeGuard
pub struct DefaultRuntimeGuard { /* private fields */ }Expand description
Guard returned by set_default_runtime.
When dropped, the previous runtime context is restored.
Guard returned by set_default_runtime.
When dropped, the previous runtime context is restored.
§Examples
use tenferro_internal_runtime::{set_default_runtime, with_default_runtime, RuntimeContext};
use tenferro_prims::CpuContext;
let _guard = set_default_runtime(RuntimeContext::Cpu(CpuContext::new(1)));
let name = with_default_runtime(|ctx| Ok(ctx.name())).unwrap();
assert_eq!(name, "cpu");Trait Implementations§
Auto Trait Implementations§
impl Freeze for DefaultRuntimeGuard
impl !RefUnwindSafe for DefaultRuntimeGuard
impl !Send for DefaultRuntimeGuard
impl !Sync for DefaultRuntimeGuard
impl Unpin for DefaultRuntimeGuard
impl !UnwindSafe for DefaultRuntimeGuard
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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>
Converts
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>
Converts
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