Struct Printer
pub struct Printer { /* private fields */ }
A printer for a regular expression's high-level intermediate representation.
A printer converts a high-level intermediate representation (HIR) to a regular expression pattern string. This particular printer uses constant stack space and heap space proportional to the size of the HIR.
Since this printer is only using the HIR, the pattern it prints will likely
not resemble the original pattern at all. For example, a pattern like
\pL will have its entire class written out.
The purpose of this printer is to provide a means to mutate an HIR and then build a regular expression from the result of that mutation. (A regex library could provide a constructor from this HIR explicitly, but that creates an unnecessary public coupling between the regex library and this specific HIR representation.)
Implementations
impl Printer
fn new() -> PrinterCreate a new printer.
fn print<W: Write>(&mut self, hir: &Hir, wtr: W) -> ResultPrint the given
Astto the given writer. The writer must implementfmt::Write. Typical implementations offmt::Writethat can be used here are afmt::Formatter(which is available infmt::Displayimplementations) or a&mut String.
Trait Implementations
impl Debug for Printer
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl Freeze for Printer
impl RefUnwindSafe for Printer
impl Send for Printer
impl Sync for Printer
impl Unpin for Printer
impl UnsafeUnpin for Printer
impl UnwindSafe for Printer
Blanket Implementations
impl<T> Any for Printer
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Printer
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Printer
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Printer
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Printer
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Printer
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Printer
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>