Enum xrust::value::Value

source ·
pub enum Value {
Show 41 variants AnyType, Untyped, AnySimpleType, IDREFS, NMTOKENS, ENTITIES, Numeric, AnyAtomicType, UntypedAtomic, Duration, Time(DateTime<Local>), Decimal(Decimal), Float(f32), Double(f64), Integer(i64), NonPositiveInteger(NonPositiveInteger), NegativeInteger(NegativeInteger), Long(i64), Int(i32), Short(i16), Byte(i8), NonNegativeInteger(NonNegativeInteger), UnsignedLong(u64), UnsignedInt(u32), UnsignedShort(u16), UnsignedByte(u8), PositiveInteger(PositiveInteger), DateTime(DateTime<Local>), DateTimeStamp, Date(NaiveDate), String(String), NormalizedString(NormalizedString), Token, Language, NMTOKEN, Name, NCName, ID, IDREF, ENTITY, Boolean(bool),
}
Expand description

A concrete type that implements atomic values. These are the 19 predefined types in XSD Schema Part 2, plus five additional types.

Variants§

§

AnyType

node or simple type

§

Untyped

a not-yet-validated anyType

§

AnySimpleType

base type of all simple types. i.e. not a node

§

IDREFS

a list of IDREF

§

NMTOKENS

a list of NMTOKEN

§

ENTITIES

a list of ENTITY

§

Numeric

Any numeric type

§

AnyAtomicType

all atomic values (no lists or unions)

§

UntypedAtomic

untyped atomic value

§

Duration

§

Time(DateTime<Local>)

§

Decimal(Decimal)

§

Float(f32)

§

Double(f64)

§

Integer(i64)

§

NonPositiveInteger(NonPositiveInteger)

§

NegativeInteger(NegativeInteger)

§

Long(i64)

§

Int(i32)

§

Short(i16)

§

Byte(i8)

§

NonNegativeInteger(NonNegativeInteger)

§

UnsignedLong(u64)

§

UnsignedInt(u32)

§

UnsignedShort(u16)

§

UnsignedByte(u8)

§

PositiveInteger(PositiveInteger)

§

DateTime(DateTime<Local>)

§

DateTimeStamp

§

Date(NaiveDate)

§

String(String)

§

NormalizedString(NormalizedString)

§

Token

Like normalizedString, but without leading, trailing and consecutive whitespace

§

Language

language identifiers [a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*

§

NMTOKEN

NameChar+

§

Name

NameStartChar NameChar+

§

NCName

(Letter | ‘_’) NCNameChar+ (i.e. a Name without the colon)

§

ID

Same format as NCName

§

IDREF

Same format as NCName

§

ENTITY

Same format as NCName

§

Boolean(bool)

Implementations§

source§

impl Value

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 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 Display for Value

source§

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

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

impl From<&str> for Value

source§

fn from(s: &str) -> 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<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<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<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<i8> for Value

source§

fn from(i: i8) -> 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<u8> for Value

source§

fn from(i: u8) -> Self

Converts to this type from the input type.
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 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 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

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

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

source§

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

§

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.