pub enum Atomic {
Show 21 variants
Untyped(Rc<str>),
String(StringType, Rc<str>),
Float(OrderedFloat<f32>),
Double(OrderedFloat<f64>),
Decimal(Rc<Decimal>),
Integer(IntegerType, Rc<IBig>),
Duration(Rc<Duration>),
YearMonthDuration(YearMonthDuration),
DayTimeDuration(Rc<TimeDelta>),
DateTime(Rc<NaiveDateTimeWithOffset>),
DateTimeStamp(Rc<DateTime<FixedOffset>>),
Time(Rc<NaiveTimeWithOffset>),
Date(Rc<NaiveDateWithOffset>),
GYearMonth(Rc<GYearMonth>),
GYear(Rc<GYear>),
GMonthDay(Rc<GMonthDay>),
GDay(Rc<GDay>),
GMonth(Rc<GMonth>),
Boolean(bool),
Binary(BinaryType, Rc<[u8]>),
QName(Rc<OwnedName>),
}
Expand description
An atomic value.
These are designated with a xs:
namespace prefix and are described by the
XPath data model.
Variants§
Untyped(Rc<str>)
xs:untypedAtomic
String(StringType, Rc<str>)
a string type such as xs:string, xs:token, etc
Float(OrderedFloat<f32>)
xs:float
This is an ordered_float::OrderedFloat
Double(OrderedFloat<f64>)
xs:double
This is an ordered_float::OrderedFloat
Decimal(Rc<Decimal>)
xs:decimal
This is a rust_decimal::Decimal
Integer(IntegerType, Rc<IBig>)
xs integer types (xs:integer, xs:long, xs:int, etc)
This is an ibig::IBig
Duration(Rc<Duration>)
xs:duration
YearMonthDuration(YearMonthDuration)
xs:yearMonthDuration
DayTimeDuration(Rc<TimeDelta>)
xs:dayTimeDuration
This is a chrono::Duration
DateTime(Rc<NaiveDateTimeWithOffset>)
xs:dateTime
DateTimeStamp(Rc<DateTime<FixedOffset>>)
xs:dateTimeStamp
This is a chrono::DateTime
with a fixed offset
Time(Rc<NaiveTimeWithOffset>)
xs:time
Date(Rc<NaiveDateWithOffset>)
xs:date
GYearMonth(Rc<GYearMonth>)
xs:gYearMonth
GYear(Rc<GYear>)
xs:gYear
GMonthDay(Rc<GMonthDay>)
xs:gMonthDay
GDay(Rc<GDay>)
xs:gMonth
GMonth(Rc<GMonth>)
xs:gDay
Boolean(bool)
xs:boolean
Binary(BinaryType, Rc<[u8]>)
xs binary types (xs:hexBinary, xs:base64Binary)
QName(Rc<OwnedName>)
xs:QName
Implementations§
Source§impl Atomic
impl Atomic
Sourcepub fn to_string(&self) -> Result<String, Error>
pub fn to_string(&self) -> Result<String, Error>
Get the string if this atomic value is a xs:string
Sourcepub fn is_nan(&self) -> bool
pub fn is_nan(&self) -> bool
Check whether this value is the NaN value.
Only xs:float and xs:double can be NaN.
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Check whether this value is infinite.
Only xs:float and xs:double can be infinite.
Sourcepub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Check whether this value is zero.
Only numeric types can be zero.
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check whether this is a numeric value.
That is, xs:float, xs:double, xs:decimal, xs:integer and any types derived from xs:integer such as xs:int, xs:long, etc.
Sourcepub fn simple_equal(&self, other: &Atomic) -> bool
pub fn simple_equal(&self, other: &Atomic) -> bool
Compare atoms using XPath rules.
This means for instance that an integer can compare the same as a decimal. This is different from the Eq implemented for the atom itself, which compares the actual data, and different types are always distinct in that case.
Simple equal uses a comparison with the codepoint collation, and UTC as the timezone.
Trait Implementations§
Source§impl From<GYearMonth> for Atomic
impl From<GYearMonth> for Atomic
Source§fn from(g_year_month: GYearMonth) -> Atomic
fn from(g_year_month: GYearMonth) -> Atomic
Source§impl From<NaiveDateTimeWithOffset> for Atomic
impl From<NaiveDateTimeWithOffset> for Atomic
Source§fn from(date_time: NaiveDateTimeWithOffset) -> Atomic
fn from(date_time: NaiveDateTimeWithOffset) -> Atomic
Source§impl From<NaiveDateWithOffset> for Atomic
impl From<NaiveDateWithOffset> for Atomic
Source§fn from(date: NaiveDateWithOffset) -> Atomic
fn from(date: NaiveDateWithOffset) -> Atomic
Source§impl From<NaiveTimeWithOffset> for Atomic
impl From<NaiveTimeWithOffset> for Atomic
Source§fn from(time: NaiveTimeWithOffset) -> Atomic
fn from(time: NaiveTimeWithOffset) -> Atomic
Source§impl From<YearMonthDuration> for Atomic
impl From<YearMonthDuration> for Atomic
Source§fn from(year_month_duration: YearMonthDuration) -> Atomic
fn from(year_month_duration: YearMonthDuration) -> Atomic
Source§impl FromIterator<Atomic> for Sequence
impl FromIterator<Atomic> for Sequence
Source§impl TryFrom<Atomic> for NaiveDateTimeWithOffset
impl TryFrom<Atomic> for NaiveDateTimeWithOffset
Source§impl TryFrom<Atomic> for NaiveDateWithOffset
impl TryFrom<Atomic> for NaiveDateWithOffset
Source§impl TryFrom<Atomic> for NaiveTimeWithOffset
impl TryFrom<Atomic> for NaiveTimeWithOffset
impl Eq for Atomic
impl StructuralPartialEq for Atomic
Auto Trait Implementations§
impl Freeze for Atomic
impl RefUnwindSafe for Atomic
impl !Send for Atomic
impl !Sync for Atomic
impl Unpin for Atomic
impl UnwindSafe for Atomic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.