Skip to main content

InMemoryLoader

Struct InMemoryLoader 

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

In-memory loader keyed by href. Useful for tests and for embedding the ISO Schematron pipeline (where the skeleton stylesheets are bundled into the binary rather than loaded from disk).

Implementations§

Source§

impl InMemoryLoader

Source

pub fn new() -> InMemoryLoader

Source

pub fn with( self, href: impl Into<String>, text: impl Into<String>, ) -> InMemoryLoader

Register text as the contents of href. Returns self for chained insertion.

Source

pub fn insert(&mut self, href: impl Into<String>, text: impl Into<String>)

Mutable insertion — same as .with(...) but in-place.

Trait Implementations§

Source§

impl Clone for InMemoryLoader

Source§

fn clone(&self) -> InMemoryLoader

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 InMemoryLoader

Source§

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

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

impl Default for InMemoryLoader

Source§

fn default() -> InMemoryLoader

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

impl Loader for InMemoryLoader

Source§

fn load(&self, href: &str, _base: Option<&str>) -> Result<String, XsltError>

Load href’s contents. Returns the raw source as a UTF-8 string. Implementations should resolve href against base when href is relative.
Source§

fn load_parsed( &self, href: &str, base: Option<&str>, ) -> Result<Arc<Document>, XsltError>

Load href’s contents and return them as a parsed sup_xml_tree::dom::Document. Default implementation calls Self::load and parses fresh each time; loaders that expect repeated lookups for the same URI (filesystem, in-memory) should override to cache the parse result internally so the runtime doc() path doesn’t re-parse the same XML thousands of times across an apply sweep. Read more
Source§

fn resolve(&self, href: &str, base: Option<&str>) -> Result<String, XsltError>

Compute the base URI to use for files imported FROM the resource at href. Default: returns href itself (used as the base for the next level of resolution).
Source§

fn enumerate(&self, base: Option<&str>) -> Vec<String>

Enumerate every URI the loader can serve. Returned as hrefs that, when passed to Self::load with the same base, succeed. Called by the XSLT runtime when the stylesheet uses a dynamic document() / doc() URI (computed via concat / variables / @attr) — every enumerated URI is speculatively pre-loaded so that the runtime call can resolve against the pre-loaded map. 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> Same for T

Source§

type Output = T

Should always be Self
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.