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§
Source§impl 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§
Source§impl Clone for Translator
impl Clone for Translator
Source§fn clone(&self) -> Translator
fn clone(&self) -> Translator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !Freeze for Translator
impl !RefUnwindSafe for Translator
impl Send for Translator
impl !Sync for Translator
impl Unpin for Translator
impl UnwindSafe for Translator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes