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

constructor for <i4> values (signed 32-bit integers)

Available on crate feature 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.

constructor for <boolean> values (true or false)

constructor for <string> values

Note that this constructor handles string escaping for safe inclusion in XML internally. Using the TryFromValue and TryToValue trait implementations for String and &str is recommended, as those handle escaping and un-escaping automatically.

constructor for <double> values (64-bit floating point numbers)

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.

constructor for <base64> values (base64-encoded, arbitrary bytes)

Available on crate feature 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.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more
conversion method from XML-RPC method call argument lists to Rust types Read more
fallible conversion method from an XML-RPC value into the target type Read more
conversion method from types into XML-RPC method call argument lists Read more
conversion method from types into XML-RPC method call argument lists Read more
fallible conversion method from types into XML-RPC values Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.