Struct xrust::evaluate::StaticContext
source · [−]pub struct StaticContext {
pub funcs: RefCell<HashMap<String, Function>>,
pub vars: RefCell<HashMap<String, Vec<Sequence>>>,
}Expand description
Static context
Provide a static context and analysis for a Sequence Constructor.
Currently, this stores the set of functions and variables available to a constructor.
Fields
funcs: RefCell<HashMap<String, Function>>vars: RefCell<HashMap<String, Vec<Sequence>>>Implementations
sourceimpl StaticContext
impl StaticContext
sourcepub fn new() -> StaticContext
pub fn new() -> StaticContext
Creates a new StaticContext.
sourcepub fn new_with_builtins() -> StaticContext
pub fn new_with_builtins() -> StaticContext
Creates a new StaticContext and initializes it with the pre-defined XPath functions.
Currently, this is the functions defined for XPath 1.0:
-
position()
-
last()
-
count()
-
local-name()
-
name()
-
string()
-
concat()
-
starts-with()
-
contains()
-
substring()
-
substring-before()
-
substring-after()
-
normalize-space()
-
translate()
-
boolean()
-
not()
-
true()
-
false()
-
number()
-
sum()
-
floor()
-
ceiling()
-
round() These functions are defined for XPath 2.0:
-
current-dateTime()
-
current-date()
-
current-time()
-
format-dateTime()
-
format-date()
-
format-time()
sourcepub fn new_with_xslt_builtins() -> StaticContext
pub fn new_with_xslt_builtins() -> StaticContext
Create a new StaticContext with builtin functions defined, including additional functions defined by XSLT.
sourcepub fn extension_function(&mut self, name: String, _ns: String, f: Function)
pub fn extension_function(&mut self, name: String, _ns: String, f: Function)
Register an extension function
sourcepub fn declare_function(&self, n: String, _ns: String, p: Vec<Param>)
pub fn declare_function(&self, n: String, _ns: String, p: Vec<Param>)
Declares a function in the static context. The first argument is the name of the function. The second argument is the namespace URI (not currently supported). The third argument defines the arity of the function, and the types of each parameter (not currently supported).
sourcepub fn declare_variable(&self, n: String, _ns: String)
pub fn declare_variable(&self, n: String, _ns: String)
Declares a variable in the static context. The first argument is the name of the variable. The second argument is the namespace URI (not currently supported).
sourcepub fn static_analysis(&mut self, e: &mut Vec<Constructor>)
pub fn static_analysis(&mut self, e: &mut Vec<Constructor>)
Perform static analysis of a sequence constructor.
This checks that functions and variables are declared. It also rewrites the constructors to provide the implementation of functions that are used in expressions.
Auto Trait Implementations
impl !RefUnwindSafe for StaticContext
impl !Send for StaticContext
impl !Sync for StaticContext
impl Unpin for StaticContext
impl UnwindSafe for StaticContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more