Struct regex_syntax::hir::print::Printer [−][src]
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
[src]
pub fn new() -> Printer
[src]
Create a new printer.
pub fn print<W: Write>(&mut self, hir: &Hir, wtr: W) -> Result
[src]
Print the given Ast
to the given writer. The writer must implement
fmt::Write
. Typical implementations of fmt::Write
that can be used
here are a fmt::Formatter
(which is available in fmt::Display
implementations) or a &mut String
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Printer
impl Send for Printer
impl Sync for Printer
impl Unpin for Printer
impl UnwindSafe for Printer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,