pub struct PassContext { /* private fields */ }Expand description
The settings passes run under: the optimization level opt_level, the passes in
required_pass and disabled_pass, the configuration options config and the
instruments.
enter makes it the current context of the thread.
Implementations§
Source§impl PassContext
impl PassContext
Source§impl PassContext
impl PassContext
Sourcepub fn new(
opt_level: i32,
required_pass: &[&str],
disabled_pass: &[&str],
instruments: &[PassInstrument],
config: impl Into<Option<Map<String, Any>>>,
) -> Result<Self>
pub fn new( opt_level: i32, required_pass: &[&str], disabled_pass: &[&str], instruments: &[PassInstrument], config: impl Into<Option<Map<String, Any>>>, ) -> Result<Self>
Create a pass context with config checked and converted to the registered option types;
None is the empty configuration (transform.PassContext).
A pass in disabled_pass, or above opt_level and not in required_pass, is skipped.
§Errors
Returns an AttributeError if config has an option that is not registered or a None
value, or the error of converting a value to its option type.
Sourcepub fn current() -> Result<Self>
pub fn current() -> Result<Self>
Return the innermost pass context in effect on this thread, or the default one when there is
none (transform.GetCurrentPassContext).
Sourcepub fn enter(&self) -> Result<PassContextScope>
pub fn enter(&self) -> Result<PassContextScope>
Make this the current pass context until the returned PassContextScope is dropped
(transform.EnterPassContext, transform.ExitPassContext).
§Errors
Returns the error of an instrument’s enter_pass_ctx hook; the instruments entered before
it are exited, and the context’s instruments are cleared.
Sourcepub fn override_instruments(
&self,
instruments: impl IntoIterator<Item = impl IntoArg<PassInstrument>>,
) -> Result<()>
pub fn override_instruments( &self, instruments: impl IntoIterator<Item = impl IntoArg<PassInstrument>>, ) -> Result<()>
Replace the instruments with instruments, exiting the old ones and entering the new ones
(transform.OverrideInstruments).
§Errors
Returns the error of an old instrument’s exit_pass_ctx hook or a new one’s
enter_pass_ctx hook, after which the context has no instruments.
Trait Implementations§
Source§impl AsRef<ObjectRef> for PassContext
impl AsRef<ObjectRef> for PassContext
Source§impl AsRef<PassContext> for PassContext
impl AsRef<PassContext> for PassContext
Source§impl Clone for PassContext
impl Clone for PassContext
Source§fn clone(&self) -> PassContext
fn clone(&self) -> PassContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PassContext
impl Debug for PassContext
Source§impl Deref for PassContext
impl Deref for PassContext
Source§impl Display for PassContext
impl Display for PassContext
Source§impl DowncastRefFromAny for PassContext
impl DowncastRefFromAny for PassContext
Source§unsafe fn downcast_ref_from_any(cell: &TVMFFIAny) -> Option<&Self>
unsafe fn downcast_ref_from_any(cell: &TVMFFIAny) -> Option<&Self>
Source§impl From<&PassContext> for ObjectRef
impl From<&PassContext> for ObjectRef
Source§fn from(value: &PassContext) -> Self
fn from(value: &PassContext) -> Self
Source§impl From<&PassContext> for PassContext
impl From<&PassContext> for PassContext
Source§fn from(value: &PassContext) -> Self
fn from(value: &PassContext) -> Self
Source§impl From<PassContext> for ObjectRef
impl From<PassContext> for ObjectRef
Source§fn from(value: PassContext) -> Self
fn from(value: PassContext) -> Self
Source§impl<'a> IntoArg<ObjectRef> for &'a PassContext
impl<'a> IntoArg<ObjectRef> for &'a PassContext
Source§impl IntoArg<ObjectRef> for PassContext
impl IntoArg<ObjectRef> for PassContext
Source§impl<'a> IntoArg<PassContext> for &'a PassContext
impl<'a> IntoArg<PassContext> for &'a PassContext
Source§type Output = &'a PassContext
type Output = &'a PassContext
T when owned, &T when borrowed.Source§fn into_arg(self) -> &'a PassContext
fn into_arg(self) -> &'a PassContext
T or a &T.Source§fn into_owned(self) -> PassContext
fn into_owned(self) -> PassContext
T, cloning only a borrowed value.Source§impl IntoArg<PassContext> for PassContext
impl IntoArg<PassContext> for PassContext
Source§type Output = PassContext
type Output = PassContext
T when owned, &T when borrowed.Source§fn into_arg(self) -> PassContext
fn into_arg(self) -> PassContext
T or a &T.Source§fn into_owned(self) -> PassContext
fn into_owned(self) -> PassContext
T, cloning only a borrowed value.Source§impl ObjectRefAnyCompatible for PassContext
impl ObjectRefAnyCompatible for PassContext
Source§fn extra_check(obj: &Self::ContainerType) -> bool
fn extra_check(obj: &Self::ContainerType) -> bool
obj, an instance of ContainerType, is a value of Self.
Every strict and converting cast checks it, after the object type.Source§fn convert_fallback(value: AnyView<'_>) -> Option<Self>
fn convert_fallback(value: AnyView<'_>) -> Option<Self>
Self object, such as an integer that
stands for a constant; None rejects it. Only converting casts (TryFrom<Any>,
typed function arguments) call it; downcast_ref, downcast and
match_any! never do.Source§fn custom_type_str() -> String
fn custom_type_str() -> String
AnyCompatible::type_str.Source§fn custom_mismatch_type_info(value: AnyView<'_>) -> String
fn custom_mismatch_type_info(value: AnyView<'_>) -> String
value in conversion errors; by default its
runtime type key. See AnyCompatible::get_mismatch_type_info.Source§impl ObjectRefCore for PassContext
impl ObjectRefCore for PassContext
Source§type ContainerType = PassContextObj
type ContainerType = PassContextObj
Source§fn data(this: &Self) -> &ObjectArc<Self::ContainerType>
fn data(this: &Self) -> &ObjectArc<Self::ContainerType>
Source§fn into_data(this: Self) -> ObjectArc<Self::ContainerType>
fn into_data(this: Self) -> ObjectArc<Self::ContainerType>
Source§unsafe fn from_data(data: ObjectArc<Self::ContainerType>) -> Self
unsafe fn from_data(data: ObjectArc<Self::ContainerType>) -> Self
Source§fn same_as<Other>(&self, other: &Other) -> boolwhere
Other: ObjectRefCore,
fn same_as<Other>(&self, other: &Other) -> boolwhere
Other: ObjectRefCore,
Source§fn type_key(&self) -> &'static str
fn type_key(&self) -> &'static str
"ffi.Array", as C++ ObjectRef::GetTypeKey.Source§fn is<T>(&self) -> boolwhere
T: AnyCompatible,
fn is<T>(&self) -> boolwhere
T: AnyCompatible,
T as is, such as a subtype or a container
whose elements are checked too, by the strict check of
downcast, without a reference count change.
See also crate::Any::is.Source§impl<'a> PackedCallArg for &'a PassContext
impl<'a> PackedCallArg for &'a PassContext
Source§type Holder = &'a PassContext
type Holder = &'a PassContext
fn into_packed_arg(self) -> &'a PassContext
fn as_packed_arg(holder: &Self::Holder) -> AnyView<'_>
Source§impl PackedCallArg for PassContext
impl PackedCallArg for PassContext
Source§type Holder = PassContext
type Holder = PassContext
fn into_packed_arg(self) -> PassContext
fn as_packed_arg(holder: &Self::Holder) -> AnyView<'_>
Source§impl<'a> TryFrom<&'a Any> for PassContext
impl<'a> TryFrom<&'a Any> for PassContext
Source§impl TryFrom<&ObjectRef> for PassContext
impl TryFrom<&ObjectRef> for PassContext
Source§impl TryFrom<Any> for PassContext
impl TryFrom<Any> for PassContext
Source§impl<'a> TryFrom<AnyView<'a>> for PassContext
impl<'a> TryFrom<AnyView<'a>> for PassContext
Source§impl TryFrom<ObjectRef> for PassContext
impl TryFrom<ObjectRef> for PassContext
impl TypeSubsumes<PassContext> for ObjectRef
Auto Trait Implementations§
impl Freeze for PassContext
impl RefUnwindSafe for PassContext
impl !Send for PassContext
impl !Sync for PassContext
impl Unpin for PassContext
impl UnsafeUnpin for PassContext
impl UnwindSafe for PassContext
Blanket Implementations§
Source§impl<T> AnyCompatible for Twhere
T: ObjectRefAnyCompatible,
impl<T> AnyCompatible for Twhere
T: ObjectRefAnyCompatible,
const MATCH_ANY_EXACT: bool
fn match_any_exact_type_index() -> i32
Source§unsafe fn is_undefined(field: *const T) -> bool
unsafe fn is_undefined(field: *const T) -> bool
field, which holds a value of this type or all-zero bytes,
holds all-zero bytes that are no value of this type, as a null object
reference, a string of type index None or a zero device type: a field
that a creator left undefined for reflection to set. An undefined field
is no value; a nullable reference is Option<T>, whose None is a
defined value. Read moreSource§unsafe fn copy_to_any_view(src: &T, data: &mut TVMFFIAny)
unsafe fn copy_to_any_view(src: &T, data: &mut TVMFFIAny)
Source§unsafe fn move_to_any(src: T, data: &mut TVMFFIAny)
unsafe fn move_to_any(src: T, data: &mut TVMFFIAny)
Source§unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
Source§unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> T
unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> T
Self out of a cell that holds one, retaining any object. Read moreSource§unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> T
unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> T
Self out of an owning cell that holds one. Read moreSource§unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<T, ()>
unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<T, ()>
data into a Self by the FFI rules, such as an integer into a
float; Err if it does not convert. Read moreSource§fn get_mismatch_type_info(data: &TVMFFIAny) -> String
fn get_mismatch_type_info(data: &TVMFFIAny) -> String
data in conversion errors; by
default its runtime type key.Source§fn type_str() -> String
fn type_str() -> String
int,
ffi.String or Array<int>.Source§fn type_schema() -> String
fn type_schema() -> String
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> IntoExpr<T> for S
impl<T, S> IntoExpr<T> for S
Source§type Output = <S as IntoArg<T>>::Output
type Output = <S as IntoArg<T>>::Output
T for an owned value or a literal, or a borrowed &T for a
reference, which converts without a reference-count change. Read moreSource§fn into_expr(self) -> Result<<S as IntoArg<T>>::Output, Error>
fn into_expr(self) -> Result<<S as IntoArg<T>>::Output, Error>
ExprResult raised.Source§fn into_owned_expr(self) -> Result<T>where
Self: Sized,
fn into_owned_expr(self) -> Result<T>where
Self: Sized,
Cow::into_owned
does: an owned value moves, and only a borrowed expression is cloned.