pub struct DisplayTemplate { /* private fields */ }Expand description
Parsed display template (display = '[<ts>] <level> <msg>').
Syntax:
<fieldname>— replaced with the field’s captured value (empty if the regex didn’t capture it on this line).\<— literal<.\\— literal\.- Anything else — literal.
Implementations§
Source§impl DisplayTemplate
impl DisplayTemplate
pub fn compile(source: &str, field_names: &[String]) -> Result<Self, String>
Sourcepub fn render(&self, lookup: impl Fn(&str) -> Option<String>) -> String
pub fn render(&self, lookup: impl Fn(&str) -> Option<String>) -> String
Render the template against a captures-lookup closure. Returns the rendered string. Missing fields render as empty.
pub fn source(&self) -> &str
Trait Implementations§
Source§impl Clone for DisplayTemplate
impl Clone for DisplayTemplate
Source§fn clone(&self) -> DisplayTemplate
fn clone(&self) -> DisplayTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DisplayTemplate
impl RefUnwindSafe for DisplayTemplate
impl Send for DisplayTemplate
impl Sync for DisplayTemplate
impl Unpin for DisplayTemplate
impl UnsafeUnpin for DisplayTemplate
impl UnwindSafe for DisplayTemplate
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
Mutably borrows from an owned value. Read more