Struct regex_syntax::hir::translate::Translator
source · [−]pub struct Translator { /* private fields */ }
Expand description
A translator maps abstract syntax to a high level intermediate representation.
A translator may be benefit from reuse. That is, a translator can translate many abstract syntax trees.
A Translator
can be configured in more detail via a
TranslatorBuilder
.
Implementations
sourceimpl Translator
impl Translator
sourcepub fn new() -> Translator
pub fn new() -> Translator
Create a new translator using the default configuration.
sourcepub fn translate(&mut self, pattern: &str, ast: &Ast) -> Result<Hir, Error>
pub fn translate(&mut self, pattern: &str, ast: &Ast) -> Result<Hir, Error>
Translate the given abstract syntax tree (AST) into a high level intermediate representation (HIR).
If there was a problem doing the translation, then an HIR-specific error is returned.
The original pattern string used to produce the Ast
must also be
provided. The translator does not use the pattern string during any
correct translation, but is used for error reporting.
Trait Implementations
sourceimpl Clone for Translator
impl Clone for Translator
sourcefn clone(&self) -> Translator
fn clone(&self) -> Translator
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Translator
impl Send for Translator
impl !Sync for Translator
impl Unpin for Translator
impl UnwindSafe for Translator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more