Fields v0.1.0

Source
Typed key-value fields that a record carries.

Value

pub variant Value {
    Text(char8[..]),
    Integer(int64),
    Unsigned(uint64),
    Float(float64),
    Boolean(bool)
}

The value of a field. Copy.

Source

Cases

NameDescription
Text(char8[..])Text, borrowed from the caller for as long as the record is being written.
Integer(int64)A signed integer.
Unsigned(uint64)An unsigned integer.
Float(float64)A floating-point number. JSON records write a value that is not finite as null.
Boolean(bool)A truth value.

Field

pub struct Field {
    pub key: char8[..];
    pub value: Value;
}

A named value of a record. Copy.

Source

Fields

NameTypeDescription
keychar8[..]The name, which should be a plain identifier so that every format writes it unquoted.
valueValueThe value.

Associated functions

Text

pub func Text(key: char8[..], value: char8[..]) -> Field

A field of text.

NameTypeDescription
keychar8[..]the name
valuechar8[..]the text, borrowed until the record is written

Returns: the field

Source

Integer

pub func Integer(key: char8[..], value: int64) -> Field

A field of a signed integer.

NameTypeDescription
keychar8[..]the name
valueint64the number

Returns: the field

Source

Unsigned

pub func Unsigned(key: char8[..], value: uint64) -> Field

A field of an unsigned integer.

NameTypeDescription
keychar8[..]the name
valueuint64the number

Returns: the field

Source

Float

pub func Float(key: char8[..], value: float64) -> Field

A field of a floating-point number.

NameTypeDescription
keychar8[..]the name
valuefloat64the number

Returns: the field

Source

Boolean

pub func Boolean(key: char8[..], value: bool) -> Field

A field of a truth value.

NameTypeDescription
keychar8[..]the name
valueboolthe value

Returns: the field

Source