Skip to main content

Value

Struct Value 

Source
pub struct Value {
    pub value: ValueData,
    pub output: OutputSpec,
}
Expand description

A concrete type that implements atomic values. These are the 19 predefined types in XSD Schema Part 2, plus five additional types. Also included is a hint for serialisation for if the value should be escaped.

Fields§

§value: ValueData§output: OutputSpec

Implementations§

Source§

impl Value

Source

pub fn value_ref(&self) -> &ValueData

Source

pub fn output_ref(&self) -> &OutputSpec

Source§

impl Value

Source

pub fn new_time(t: DateTime<Local>) -> Self

Create a Time, ignoring the date part

Source

pub fn new_date(d: NaiveDate) -> Self

Create a date

Source

pub fn to_bool(&self) -> bool

Give the effective boolean value.

Source

pub fn to_int(&self) -> Result<i64, Error>

Convert the value to an integer, if possible.

Source

pub fn to_double(&self) -> f64

Convert the value to a double. If the value cannot be converted, returns Nan.

Source

pub fn value_type(&self) -> &'static str

Source

pub fn compare(&self, other: &Value, op: Operator) -> Result<bool, Error>

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Display for Value

Source§

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

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

impl Eq for Value

Source§

impl From<&Value> for ValueBuilder

Derive a new ValueBuilder from an existing Value. The value data in the old Value will be copied to the builder.

Source§

fn from(v: &Value) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for Value

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<DateTime<Local>> for Value

Source§

fn from(dt: DateTime<Local>) -> Self

Converts to this type from the input type.
Source§

impl From<Decimal> for Value

Source§

fn from(d: Decimal) -> Self

Converts to this type from the input type.
Source§

impl From<ID> for Value

Source§

fn from(n: ID) -> Self

Converts to this type from the input type.
Source§

impl From<IDREF> for Value

Source§

fn from(n: IDREF) -> Self

Converts to this type from the input type.
Source§

impl From<NamespaceUri> for Value

Source§

fn from(q: NamespaceUri) -> Self

Converts to this type from the input type.
Source§

impl From<NcName> for Value

Source§

fn from(q: NcName) -> Self

Converts to this type from the input type.
Source§

impl From<NegativeInteger> for Value

Source§

fn from(n: NegativeInteger) -> Self

Converts to this type from the input type.
Source§

impl From<NonNegativeInteger> for Value

Source§

fn from(n: NonNegativeInteger) -> Self

Converts to this type from the input type.
Source§

impl From<NonPositiveInteger> for Value

Source§

fn from(n: NonPositiveInteger) -> Self

Converts to this type from the input type.
Source§

impl From<NormalizedString> for Value

Source§

fn from(n: NormalizedString) -> Self

Converts to this type from the input type.
Source§

impl From<PositiveInteger> for Value

Source§

fn from(p: PositiveInteger) -> Self

Converts to this type from the input type.
Source§

impl From<QName> for Value

Source§

fn from(q: QName) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl<N: Node> From<Value> for Sequence<N>

Source§

fn from(v: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<IDREF>> for Value

Source§

fn from(v: Vec<IDREF>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Value

Source§

fn from(f: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(f: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(i: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(i: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(i: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(i: i64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(i: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(i: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(i: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(i: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(u: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Value) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Value

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnsafeUnpin 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.