Struct dxr_shared::Value
source · 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.
Note that the constructors for all primitive value types are infallible, except for the string type, which can fail if the string argument fails to be escaped properly for XML.
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, HashMaps, and even custom structs, when using the TryFromValue and
TryToValue derive macros.
Implementations
sourceimpl 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: DateTime<Utc>) -> Value
pub fn datetime(value: DateTime<Utc>) -> Value
constructor for <dateTime.iso8601> values (date & time)
Note that the date & time format used by XML-RPC does not include sub-second precision, nor
any timezone information. This crate assumes Utc is used on the server.
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 Options to either their contained Value, or to a <nil> value. This is
consistent with the XML-RPC implementation in the Python xmlrpc standard library module.