pub struct PushLazy<F>(pub F);
A newtype for non-return based lazy values
It's more natural for closures used as lazy values to return
implementing type, but sometimes that forces an allocation (eg. Strings)
In some cases it might make sense for another closure form to be used - one taking a serializer as an argument, which avoids lifetimes / allocation issues.
Unfortunately, as one
struct can implement many different closure traits,
a newtype has to be used to prevent ambiguity.
Generally this method should be used only if it avoids a big allocation of
Serialize-implementing type in performance-critical logging statement.
PushLazy be avoided?
impl<F> Serialize for PushLazy<F> where F: 'static + for<'c, 'd> Fn(&'c Record<'d>, ValueSerializer<'c>) -> Result<(), Error>[src]
Serialize self into
Serializer Read more