pub enum Value<'a> {
Null,
Bool(bool),
I64(i64),
U64(u64),
F64(f64),
Str(&'a str),
Char(char),
}Expand description
A field value attached to a log record.
All variants borrow their data. Construct a Value at the call site
from a borrowed source so the record carries no heap allocation.
Variants§
Null
Absence of a value. Serializes as null in JSON, the empty
string in logfmt, and <null> in the human-readable format.
Bool(bool)
A boolean.
I64(i64)
A signed 64-bit integer.
U64(u64)
An unsigned 64-bit integer.
F64(f64)
A 64-bit float. NaN and inf are serialized as JSON null
per RFC 8259 since they have no JSON representation; logfmt and
the human format emit the lowercase debug representation.
Str(&'a str)
A borrowed string slice.
Char(char)
A borrowed character. Serialized as a one-character string.
Implementations§
Source§impl<'a> Value<'a>
impl<'a> Value<'a>
Sourcepub const fn is_null(&self) -> bool
pub const fn is_null(&self) -> bool
Returns true if this value is Self::Null.
Sourcepub const fn variant_name(&self) -> &'static str
pub const fn variant_name(&self) -> &'static str
Returns the static name of the variant. Useful in diagnostics.
Trait Implementations§
impl<'a> Copy for Value<'a>
impl<'a> StructuralPartialEq for Value<'a>
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnsafeUnpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
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