pub struct AnalyzerResources(/* private fields */);Expand description
Cloneable compilation owner; resolved revisions remain valid after cache eviction.
use uqa_analysis::{standard_analyzer, AnalyzerLimits, AnalyzerResources};
let resources = AnalyzerResources::new(AnalyzerLimits::default());
let compiled = resources.compile(&standard_analyzer("english"))?;
let saved = compiled.descriptor().canonical_json();
let restored = resources.restore_json(saved)?;
assert!(std::sync::Arc::ptr_eq(&compiled, &restored));
assert_eq!(restored.analyze("The cats and")?, ["cat"]);Implementations§
Source§impl AnalyzerResources
impl AnalyzerResources
Sourcepub fn new(limits: AnalyzerLimits) -> Self
pub fn new(limits: AnalyzerLimits) -> Self
Create an independent owner with fixed descriptor and retention limits.
pub fn limits(&self) -> AnalyzerLimits
pub fn cache_stats(&self) -> AnalyzerCacheStats
pub fn compile( &self, config: &Analyzer, ) -> AnalysisResult<Arc<CompiledAnalyzer>>
pub fn compile_with_length_policy( &self, config: &Analyzer, policy: TokenLengthPolicy, ) -> AnalysisResult<Arc<CompiledAnalyzer>>
Sourcepub fn restore(
&self,
descriptor: Arc<AnalyzerDescriptor>,
) -> AnalysisResult<Arc<CompiledAnalyzer>>
pub fn restore( &self, descriptor: Arc<AnalyzerDescriptor>, ) -> AnalysisResult<Arc<CompiledAnalyzer>>
Compile verified resolved inputs without consulting mutable files or named definitions.
Sourcepub fn restore_json(&self, json: &str) -> AnalysisResult<Arc<CompiledAnalyzer>>
pub fn restore_json(&self, json: &str) -> AnalysisResult<Arc<CompiledAnalyzer>>
Validate the persisted fingerprint and runtime profiles before publishing a compiled handle.
Trait Implementations§
Source§impl Clone for AnalyzerResources
impl Clone for AnalyzerResources
Source§fn clone(&self) -> AnalyzerResources
fn clone(&self) -> AnalyzerResources
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AnalyzerResources
impl !UnwindSafe for AnalyzerResources
impl Freeze for AnalyzerResources
impl Send for AnalyzerResources
impl Sync for AnalyzerResources
impl Unpin for AnalyzerResources
impl UnsafeUnpin for AnalyzerResources
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