Skip to main content

ValueType

Struct ValueType 

Source
pub struct ValueType { /* private fields */ }
Expand description

What is statically known of the value of a variable, or of the result of a host function, as Saxon-HE 12.10 infers it in a stylesheet: its item type at each moment of the compilation and, when Saxon replaces the references to the variable by a literal, its value. A reference compiled with it has that type, and is that literal (the same value as the variable’s, which is then context-free).

Implementations§

Source§

impl ValueType

Source

pub fn unknown() -> Self

Nothing known: any value.

Source

pub fn declared(as_type: Option<&SequenceType>) -> Self

The type of a parameter (of the stylesheet, of a template, of a function), or of the result of a function: its declared type (as), whatever its default value, any value without one.

Source

pub fn global_variable( value: BindingValue<'_>, as_type: Option<&SequenceType>, ) -> Self

The type of a global xsl:variable (not a parameter). Saxon infers it before type checking anything (SourceBinding.getInferredType): the type of the parsed select expression (arithmetic, a host function call and a reference to a global declared later are then of unknown type), narrowed to the declared one, or the declared type when the value is not a subtype of it. A literal select that is of the declared type is a constant: the references are that literal.

Source

pub fn local_variable( value: BindingValue<'_>, as_type: Option<&SequenceType>, ) -> Self

The type of a local xsl:variable. Saxon gives its references the type inferred as for a global variable while the instructions are type-checked one by one, then, when the body is, the type of the type-checked value (narrowed to the declared type), if it is a subtype of the inferred one (LetExpression.typeCheck, VariableReference.refineVariableType). The references are a literal when the select is one when parsed, or once type-checked, or once optimized (the optimizer then inlines it), if of the declared type.

Source

pub fn declared_later(&self) -> Self

The same value, referred to from a declaration that Saxon processes before this global variable’s (one earlier in the stylesheet): the reference is then of unknown type for the inference of the type of a variable declared there.

Trait Implementations§

Source§

impl Clone for ValueType

Source§

fn clone(&self) -> Self

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 ValueType

Source§

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

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

impl Default for ValueType

Source§

fn default() -> Self

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

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.