pub struct Value { /* private fields */ }
Expand description
§XML-RPC value type
The Value
type is the Rust equivalent of valid XML-RPC values. It provides constructors
from all compatible primitive types, (de)serialization support from and to XML-RPC value
strings, and fallible conversion from and to Value
with implementations of the
TryFromValue
and TryToValue
traits.
In general, using methods from the fallible TryFromValue
and TryToValue
conversion
traits is recommended, as they provide a consistent interface across all types, including
Vec
, arrays, slices, tuples, HashMap
s, and even custom structs, when using the
TryFromValue
and TryToValue
derive macros (or implementing the traits manually).
Implementations§
source§impl Value
impl Value
sourcepub fn i8(value: i64) -> Value
Available on crate feature i8
only.
pub fn i8(value: i64) -> Value
i8
only.constructor for <i8>
values (signed 64-bit integers)
This type is not part of the original XML-RPC spec, but is a widely used extension.
Support for <i8>
values is optional and can be enabled with the i8
crate feature.
sourcepub fn double(value: f64) -> Value
pub fn double(value: f64) -> Value
constructor for <double>
values (64-bit floating point numbers)
sourcepub fn datetime(value: NaiveDateTime) -> Value
pub fn datetime(value: NaiveDateTime) -> Value
constructor for <dateTime.iso8601>
values (timezone-unaware date & time)
Note that the date & time format used by XML-RPC does not include sub-second precision, nor any timezone information.
sourcepub fn base64(value: Vec<u8>) -> Value
pub fn base64(value: Vec<u8>) -> Value
constructor for <base64>
values (base64-encoded arbitrary bytes)
sourcepub fn nil() -> Value
Available on crate feature nil
only.
pub fn nil() -> Value
nil
only.constructor for the <nil/>
value (empty / missing value)
This type is not part of the original XML-RPC spec, but is a widely used extension.
Support for <nil>
values is optional and can be enabled with the nil
crate feature.
If enabled, this type is used to emulate support for optional values in XML-RPC, by mapping
Rust Option
s to either their contained Value
if the value is Some<T>
, or to a
<nil/>
the value is None
.
This is consistent with the XML-RPC implementation in the Python xmlrpc
standard library
module, which also maps None
values to <nil/>
.