pub struct TransformCtx<'ctx> {
pub options: TransformOptions,
pub translated: TranslatedCrate,
pub errors: ErrorCtx<'ctx>,
}
Expand description
Simpler context used for rustc-independent code transformation. This only depends on rustc for its error reporting machinery.
Fields§
§options: TransformOptions
The options that control transformation.
translated: TranslatedCrate
The translated data.
errors: ErrorCtx<'ctx>
Context for tracking and reporting errors.
Implementations§
source§impl<'ctx> TransformCtx<'ctx>
impl<'ctx> TransformCtx<'ctx>
pub(crate) fn continue_on_failure(&self) -> bool
pub(crate) fn has_errors(&self) -> bool
pub(crate) fn with_def_id<F, T>(
&mut self,
def_id: impl Into<AnyTransId>,
def_id_is_local: bool,
f: F,
) -> Twhere
F: FnOnce(&mut Self) -> T,
sourcepub(crate) fn with_mut_bodies<R>(
&mut self,
f: impl FnOnce(&mut Self, &mut Vector<BodyId, Body>) -> R,
) -> R
pub(crate) fn with_mut_bodies<R>( &mut self, f: impl FnOnce(&mut Self, &mut Vector<BodyId, Body>) -> R, ) -> R
Get mutable access to both the ctx and the bodies.
sourcepub(crate) fn with_mut_fun_decls<R>(
&mut self,
f: impl FnOnce(&mut Self, &mut Vector<FunDeclId, FunDecl>) -> R,
) -> R
pub(crate) fn with_mut_fun_decls<R>( &mut self, f: impl FnOnce(&mut Self, &mut Vector<FunDeclId, FunDecl>) -> R, ) -> R
Get mutable access to both the ctx and the function declarations.
sourcepub(crate) fn for_each_body(&mut self, f: impl FnMut(&mut Self, &mut Body))
pub(crate) fn for_each_body(&mut self, f: impl FnMut(&mut Self, &mut Body))
Mutably iterate over the bodies.
pub(crate) fn for_each_structured_body( &mut self, f: impl FnMut(&mut Self, &mut ExprBody), )
Trait Implementations§
source§impl Display for TransformCtx<'_>
impl Display for TransformCtx<'_>
Auto Trait Implementations§
impl<'ctx> Freeze for TransformCtx<'ctx>
impl<'ctx> !RefUnwindSafe for TransformCtx<'ctx>
impl<'ctx> !Send for TransformCtx<'ctx>
impl<'ctx> !Sync for TransformCtx<'ctx>
impl<'ctx> Unpin for TransformCtx<'ctx>
impl<'ctx> !UnwindSafe for TransformCtx<'ctx>
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<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Indentable for Twhere
T: Display,
impl<T> Indentable for Twhere
T: Display,
§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>
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§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more