pub struct SimpleStaticContext { /* private fields */ }Expand description
A static context built by hand: namespaces, variables and functions declared one by one.
Implementations§
Source§impl SimpleStaticContext
impl SimpleStaticContext
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty context: no namespaces, variables or functions, no XSLT functions.
Sourcepub fn with_namespaces(self, namespaces: NamespaceMap) -> Self
pub fn with_namespaces(self, namespaces: NamespaceMap) -> Self
Uses these prefix bindings for system-property().
Sourcepub const fn with_xslt_functions(self) -> Self
pub const fn with_xslt_functions(self) -> Self
Makes the XSLT functions available.
Sourcepub fn declare_variable(
&mut self,
name: QName,
cardinality: Cardinality,
) -> VariableId
pub fn declare_variable( &mut self, name: QName, cardinality: Cardinality, ) -> VariableId
Declares a variable of unknown type (a later declaration of the same name hides the earlier one) and returns its identity: the declaration order, from 0.
Sourcepub fn declare_typed_variable(
&mut self,
name: QName,
cardinality: Cardinality,
value_type: ValueType,
) -> VariableId
pub fn declare_typed_variable( &mut self, name: QName, cardinality: Cardinality, value_type: ValueType, ) -> VariableId
Declares a variable of that static type, as Self::declare_variable.
Sourcepub fn declare_function(&mut self, name: QName, arity: usize) -> FunctionId
pub fn declare_function(&mut self, name: QName, arity: usize) -> FunctionId
Declares a host function whose result is of unknown type and returns its identity: the declaration order, from 0.
Sourcepub fn declare_typed_function(
&mut self,
name: QName,
arity: usize,
result: ValueType,
) -> FunctionId
pub fn declare_typed_function( &mut self, name: QName, arity: usize, result: ValueType, ) -> FunctionId
Declares a host function whose result is of that static type, as
Self::declare_function.
Trait Implementations§
Source§impl Clone for SimpleStaticContext
impl Clone for SimpleStaticContext
Source§impl Debug for SimpleStaticContext
impl Debug for SimpleStaticContext
Source§impl Default for SimpleStaticContext
impl Default for SimpleStaticContext
Source§impl StaticContext for SimpleStaticContext
impl StaticContext for SimpleStaticContext
Source§fn variable(&self, name: &QName) -> Option<VariableInfo>
fn variable(&self, name: &QName) -> Option<VariableInfo>
The variable of that expanded name in scope, if any.
Source§fn function(&self, name: &QName, arity: usize) -> Option<FunctionId>
fn function(&self, name: &QName, arity: usize) -> Option<FunctionId>
The host function of that expanded name and arity, if any.
Source§fn function_type(&self, id: FunctionId) -> ValueType
fn function_type(&self, id: FunctionId) -> ValueType
The static type of what a host function returns, once its call is type-checked:
ValueType::declared with the declared result type of an xsl:function. By
default, nothing is known.Source§fn xslt_functions(&self) -> bool
fn xslt_functions(&self) -> bool
Whether the XSLT functions
current(), document() and system-property() are
available.Auto Trait Implementations§
impl Forget for SimpleStaticContext
impl Freeze for SimpleStaticContext
impl RefUnwindSafe for SimpleStaticContext
impl Send for SimpleStaticContext
impl Sync for SimpleStaticContext
impl Unpin for SimpleStaticContext
impl UnsafeUnpin for SimpleStaticContext
impl UnwindSafe for SimpleStaticContext
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
Mutably borrows from an owned value. Read more