Struct dxr::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.

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 (or implementing the traits manually).

Implementations§

source§

impl Value

source

pub fn i4(value: i32) -> Value

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

source

pub fn i8(value: i64) -> Value

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.

source

pub fn boolean(value: bool) -> Value

constructor for <boolean> values (true or false)

source

pub fn string(value: String) -> Value

constructor for <string> values

source

pub fn double(value: f64) -> Value

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

source

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.

source

pub fn base64(value: Vec<u8>) -> Value

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

source

pub fn nil() -> Value

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 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/>.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Value

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Value

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Value

source§

fn eq(&self, other: &Value) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Value

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFromParams for Value

source§

fn try_from_params(values: &[Value]) -> Result<Self, DxrError>

Fallible conversion method from XML-RPC method call argument lists to Rust values. Read more
source§

impl TryFromValue for Value

source§

fn try_from_value(value: &Value) -> Result<Value, DxrError>

Fallible conversion method from XML-RPC values into the Rust values. Read more
source§

impl TryToParams for &Value

source§

fn try_to_params(&self) -> Result<Vec<Value>, DxrError>

Fallible conversion method from Rust values into XML-RPC method call argument lists. Read more
source§

impl TryToParams for Value

source§

fn try_to_params(&self) -> Result<Vec<Value>, DxrError>

Fallible conversion method from Rust values into XML-RPC method call argument lists. Read more
source§

impl TryToValue for Value

source§

fn try_to_value(&self) -> Result<Value, DxrError>

Fallible conversion method from Rust values into XML-RPC values. Read more
source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,