Packages

SIMD-accelerated XML parser with full XPath 1.0. Rustler NIF wrapping simdxml for blazing fast XML processing.

Current section

Files

Jump to
simdxml native simdxml_nif src compiled.rs
Raw

native/simdxml_nif/src/compiled.rs

use rustler::ResourceArc;
use simdxml::CompiledXPath;
pub struct CompiledXPathResource {
pub inner: CompiledXPath,
}
#[rustler::resource_impl]
impl rustler::Resource for CompiledXPathResource {}
#[rustler::nif]
pub fn compile_xpath(expr: &str) -> Result<ResourceArc<CompiledXPathResource>, String> {
let compiled =
CompiledXPath::compile(expr).map_err(|e: simdxml::SimdXmlError| e.to_string())?;
Ok(ResourceArc::new(CompiledXPathResource { inner: compiled }))
}