Fields v0.1.0
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.
Cases
| Name | Description |
|---|---|
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.
Fields
| Name | Type | Description |
|---|---|---|
key | char8[..] | The name, which should be a plain identifier so that every format writes it unquoted. |
value | Value | The value. |
Associated functions
Text
pub func Text(key: char8[..], value: char8[..]) -> Field
A field of text.
| Name | Type | Description |
|---|---|---|
key | char8[..] | the name |
value | char8[..] | the text, borrowed until the record is written |
Returns: the field
Integer
pub func Integer(key: char8[..], value: int64) -> Field
A field of a signed integer.
| Name | Type | Description |
|---|---|---|
key | char8[..] | the name |
value | int64 | the number |
Returns: the field
Unsigned
pub func Unsigned(key: char8[..], value: uint64) -> Field
A field of an unsigned integer.
| Name | Type | Description |
|---|---|---|
key | char8[..] | the name |
value | uint64 | the number |
Returns: the field
Float
pub func Float(key: char8[..], value: float64) -> Field
A field of a floating-point number.
| Name | Type | Description |
|---|---|---|
key | char8[..] | the name |
value | float64 | the number |
Returns: the field
Boolean
pub func Boolean(key: char8[..], value: bool) -> Field
A field of a truth value.
| Name | Type | Description |
|---|---|---|
key | char8[..] | the name |
value | bool | the value |
Returns: the field