pub struct PassContextScope(/* private fields */);Expand description
A scope in which a pass context is the current one, returned by PassContext::enter.
The entered contexts are a stack of the thread: a scope stays on its thread, and the innermost scope is dropped first.
§Examples
use tvm_tirx::ir::transform::{PassContext, PassInstrument};
let outer = PassContext::new(3, &[], &[], &[], None)?;
let inner = PassContext::new(1, &[], &[], &[], None)?;
let outer_scope = outer.enter()?;
let inner_scope = inner.enter()?;
assert_eq!(PassContext::current()?.opt_level, 1);
drop(inner_scope);
assert_eq!(PassContext::current()?.opt_level, 3);
drop(outer_scope);A scope cannot move to another thread:
ⓘ
fn send<T: Send>() {}
send::<tvm_tirx::ir::transform::PassContextScope>();Trait Implementations§
Auto Trait Implementations§
impl Freeze for PassContextScope
impl RefUnwindSafe for PassContextScope
impl !Send for PassContextScope
impl !Sync for PassContextScope
impl Unpin for PassContextScope
impl UnsafeUnpin for PassContextScope
impl UnwindSafe for PassContextScope
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