[−][src]Struct c2rust_refactor::matcher::MatchCtxt
Pattern-matching context. Stores configuration that affects pattern matching behavior, and collects bindings captured during the match.
Fields
bindings: Bindings
types: BindingTypes
debug: bool
Methods
impl<'a, 'tcx> MatchCtxt<'a, 'tcx>
[src]
pub fn new(
st: &'a CommandState,
cx: &'a RefactorCtxt<'a, 'tcx>
) -> MatchCtxt<'a, 'tcx>
[src]
st: &'a CommandState,
cx: &'a RefactorCtxt<'a, 'tcx>
) -> MatchCtxt<'a, 'tcx>
pub fn parse_expr(&mut self, src: &str) -> P<Expr>
[src]
pub fn parse_pat(&mut self, src: &str) -> P<Pat>
[src]
pub fn parse_ty(&mut self, src: &str) -> P<Ty>
[src]
pub fn parse_stmts(&mut self, src: &str) -> Vec<Stmt>
[src]
pub fn parse_items(&mut self, src: &str) -> Vec<P<Item>>
[src]
pub fn try_match<T: TryMatch>(&mut self, pat: &T, target: &T) -> Result<()>
[src]
Try to match target
against pat
, updating self.bindings
with the results.
pub fn from_match<T: TryMatch>(
st: &'a CommandState,
cx: &'a RefactorCtxt<'a, 'tcx>,
pat: &T,
target: &T
) -> Result<MatchCtxt<'a, 'tcx>>
[src]
st: &'a CommandState,
cx: &'a RefactorCtxt<'a, 'tcx>,
pat: &T,
target: &T
) -> Result<MatchCtxt<'a, 'tcx>>
Build a new MatchCtxt
, and try to match target
against pat
in that context.
pub fn clone_match<T: TryMatch>(
&self,
pat: &T,
target: &T
) -> Result<MatchCtxt<'a, 'tcx>>
[src]
&self,
pat: &T,
target: &T
) -> Result<MatchCtxt<'a, 'tcx>>
Clone this context and try to perform a match in the clone, returning Ok
if it succeeds.
pub fn set_type<S: IntoSymbol>(&mut self, name: S, ty: BindingType)
[src]
pub fn maybe_capture_ident(
&mut self,
pattern: &Ident,
target: &Ident
) -> Result<bool>
[src]
&mut self,
pattern: &Ident,
target: &Ident
) -> Result<bool>
Try to capture an ident. Returns Ok(true)
if it captured, Ok(false)
if pattern
is
not a capturing pattern, or Err(_)
if capturing failed.
pub fn maybe_capture_label(
&mut self,
pattern: &Label,
target: &Label
) -> Result<bool>
[src]
&mut self,
pattern: &Label,
target: &Label
) -> Result<bool>
pub fn maybe_capture_path(
&mut self,
pattern: &Path,
target: &Path
) -> Result<bool>
[src]
&mut self,
pattern: &Path,
target: &Path
) -> Result<bool>
pub fn maybe_capture_expr(
&mut self,
pattern: &Expr,
target: &Expr
) -> Result<bool>
[src]
&mut self,
pattern: &Expr,
target: &Expr
) -> Result<bool>
pub fn maybe_capture_pat(&mut self, pattern: &Pat, target: &Pat) -> Result<bool>
[src]
pub fn maybe_capture_ty(&mut self, pattern: &Ty, target: &Ty) -> Result<bool>
[src]
pub fn maybe_capture_stmt(
&mut self,
pattern: &Stmt,
target: &Stmt
) -> Result<bool>
[src]
&mut self,
pattern: &Stmt,
target: &Stmt
) -> Result<bool>
pub fn do_marked<T, F>(
&mut self,
tts: &TokenStream,
func: F,
target: &T
) -> Result<()> where
T: TryMatch + GetNodeId,
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, T>,
[src]
&mut self,
tts: &TokenStream,
func: F,
target: &T
) -> Result<()> where
T: TryMatch + GetNodeId,
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, T>,
Handle the marked!(...)
matching form.
pub fn do_def_expr(&mut self, tts: &TokenStream, target: &Expr) -> Result<()>
[src]
Handle the def!(...)
matching form for exprs.
pub fn do_def_ty(&mut self, tts: &TokenStream, target: &Ty) -> Result<()>
[src]
Handle the def!(...)
matching form for exprs.
pub fn do_typed<T, F>(
&mut self,
tts: &TokenStream,
func: F,
target: &T
) -> Result<()> where
T: TryMatch + GetNodeId,
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, T>,
[src]
&mut self,
tts: &TokenStream,
func: F,
target: &T
) -> Result<()> where
T: TryMatch + GetNodeId,
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, T>,
Handle the typed!(...)
matching form.
pub fn do_cast<F>(
&mut self,
tts: &TokenStream,
func: F,
target: &Expr
) -> Result<()> where
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, P<Expr>>,
[src]
&mut self,
tts: &TokenStream,
func: F,
target: &Expr
) -> Result<()> where
F: for<'b> FnOnce(&mut Parser<'b>) -> PResult<'b, P<Expr>>,
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Lone for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> Send for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Same for T
type Output = T
Should always be Self
impl<T> MaybeResult for T
[src]
impl<'a, T> Captures for T where
T: ?Sized,
[src]
T: ?Sized,