Sequence

Enum Sequence 

Source
pub enum Sequence {
    Empty(Empty),
    One(One),
    Many(Many),
    Range(Range),
}

Variants§

§

Empty(Empty)

§

One(One)

§

Many(Many)

§

Range(Range)

Implementations§

Source§

impl Sequence

Source

pub fn deep_equal( &self, other: &Sequence, collation: &Collation, default_offset: FixedOffset, xot: &Xot, ) -> Result<bool, Error>

Compare two sequences using XPath deep equal rules.

https://www.w3.org/TR/xpath-functions-31/#func-deep-equal

Source§

impl Sequence

Source

pub fn is_empty(&self) -> bool

Check whether the sequence is empty

Source

pub fn len(&self) -> usize

Get the sequence length

Source

pub fn get(&self, index: usize) -> Option<Item>

Get an item in the index, if it exists

Source

pub fn one(self) -> Result<Item, Error>

Get a single item from the sequence, if it only contains one item

Otherwise you get a type error.

Source

pub fn option(self) -> Result<Option<Item>, Error>

Get a optional item from the sequence

If it contains more than one item, you get a type error.

Source

pub fn iter(&self) -> Box<dyn Iterator<Item = Item> + '_>

Get the items from the sequence as an iterator

Source

pub fn effective_boolean_value(&self) -> Result<bool, Error>

Effective boolean value

Source

pub fn string_value(&self, xot: &Xot) -> Result<String, Error>

String value

Source

pub fn nodes<'a>(&'a self) -> Box<dyn Iterator<Item = Result<Node, Error>> + 'a>

Iterator over the nodes in the sequence

An error is returned for items that are not a node.

Source

pub fn atomized<'a>( &'a self, xot: &'a Xot, ) -> Box<dyn Iterator<Item = Result<Atomic, Error>> + 'a>

Iterator for the atomized values in the sequence

Source

pub fn atomized_one(&self, xot: &Xot) -> Result<Atomic, Error>

Get just one atomized value from the sequence

If there are less or more, you get a type error.

Source

pub fn atomized_option(&self, xot: &Xot) -> Result<Option<Atomic>, Error>

Get an optional atomized value from the sequence

If there are more than one, you get a type error.

Source

pub fn map_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = Result<Map, Error>> + 'a>

Iterator over the XPath maps in the sequence

An error is returned for items that are not a map.

Source

pub fn array_iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = Result<Array, Error>> + 'a>

Iterator over the XPath arrays in the sequence

An error is returned for items that are not an array.

Source

pub fn elements<'a>( &'a self, xot: &'a Xot, ) -> Result<Box<dyn Iterator<Item = Result<Node, Error>> + 'a>, Error>

Oterator over elements nodes in the sequence

An error is returned for items that are not an element.

Source

pub fn to_array(&self) -> Result<Array, Error>

Create an XPath array from this sequence.

Source§

impl Sequence

Source

pub fn concat(self, other: Sequence) -> Result<Sequence, Error>

Concatenate two sequences producing a new sequence.

Source

pub fn sorted( &self, context: &DynamicContext<'_>, collation: Rc<Collation>, xot: &Xot, ) -> Result<Sequence, Error>

Source

pub fn sorted_by_key<F>( &self, context: &DynamicContext<'_>, collation: Rc<Collation>, get: F, ) -> Result<Sequence, Error>
where F: FnMut(Item) -> Result<Sequence, Error>,

Source

pub fn flatten(&self) -> Result<Sequence, Error>

Flatten all arrays in this sequence

Source

pub fn normalize( &self, item_separator: &str, xot: &mut Xot, ) -> Result<Node, Error>

Normalize this sequence into a document node, according to https://www.w3.org/TR/xslt-xquery-serialization-31/#serdm

Source

pub fn serialize( &self, params: SerializationParameters, xot: &mut Xot, ) -> Result<String, Error>

Serialize this sequence according to serialization parameters

Source

pub fn display_representation( &self, xot: &Xot, context: &DynamicContext<'_>, ) -> String

Display representation of the sequence

Source§

impl Sequence

Source

pub fn matches_type<'a>( &self, s: &str, xot: &Xot, get_signature: &impl Fn(&Function) -> &'a Signature, ) -> Result<bool, Error>

Check a type for qee-qt assert-type

Trait Implementations§

Source§

impl Clone for Sequence

Source§

fn clone(&self) -> Sequence

Returns a duplicate 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 Sequence

Source§

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

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

impl Default for Sequence

Source§

fn default() -> Sequence

Returns the “default value” for a type. Read more
Source§

impl From<Array> for Sequence

Source§

fn from(array: Array) -> Sequence

Converts to this type from the input type.
Source§

impl From<BuildStackEntry> for Sequence

Source§

fn from(build: BuildStackEntry) -> Sequence

Converts to this type from the input type.
Source§

impl From<Item> for Sequence

Source§

fn from(item: Item) -> Sequence

Converts to this type from the input type.
Source§

impl From<Map> for Sequence

Source§

fn from(map: Map) -> Sequence

Converts to this type from the input type.
Source§

impl From<Node> for Sequence

Source§

fn from(node: Node) -> Sequence

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for Sequence
where T: Into<Item>,

Source§

fn from(item: Option<T>) -> Sequence

Converts to this type from the input type.
Source§

impl From<Range> for Sequence

Source§

fn from(inner: Range) -> Sequence

Converts to this type from the input type.
Source§

impl<T> From<T> for Sequence
where T: Into<Atomic>,

Source§

fn from(atomic: T) -> Sequence

Converts to this type from the input type.
Source§

impl<T> From<Vec<T>> for Sequence
where T: Into<Item>,

Source§

fn from(values: Vec<T>) -> Sequence

Converts to this type from the input type.
Source§

impl<'a> FromIterator<&'a Item> for Sequence

Source§

fn from_iter<I>(iter: I) -> Sequence
where I: IntoIterator<Item = &'a Item>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<Atomic> for Sequence

Source§

fn from_iter<I>(iter: I) -> Sequence
where I: IntoIterator<Item = Atomic>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<Item> for Sequence

Source§

fn from_iter<I>(iter: I) -> Sequence
where I: IntoIterator<Item = Item>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<Node> for Sequence

Source§

fn from_iter<I>(iter: I) -> Sequence
where I: IntoIterator<Item = Node>,

Creates a value from an iterator. Read more
Source§

impl PartialEq for Sequence

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 TryFrom<&Value> for Sequence

Source§

type Error = Error

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

fn try_from( value: &Value, ) -> Result<Sequence, <Sequence as TryFrom<&Value>>::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Sequence

Source§

type Error = Error

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

fn try_from( value: Value, ) -> Result<Sequence, <Sequence as TryFrom<Value>>::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Sequence

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

Source§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
Source§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
Source§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
Source§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
Source§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a MaybeRef.
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, 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.
Source§

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

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,