pub struct Engine { /* private fields */ }Expand description
The stateful facade handle. Holds the custom-model registry used by
parse_bundle.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn register_type(
&mut self,
type_name: &str,
hook: Box<dyn Fn(Value) -> Result<Value, String> + Send + Sync>,
)
pub fn register_type( &mut self, type_name: &str, hook: Box<dyn Fn(Value) -> Result<Value, String> + Send + Sync>, )
Register a custom object type. hook validates and/or normalizes a raw JSON
object of type_name; returning Err(message) rejects it (surfaced as a
Validation error from parse_bundle). Returning an enriched object adds
computed properties, stored as data. The hook runs only at parse time.
Sourcepub fn parse_pattern(&self, src: &str) -> Result<Pattern, FfiError>
pub fn parse_pattern(&self, src: &str) -> Result<Pattern, FfiError>
Parse a STIX pattern string into a Pattern handle.
Sourcepub fn parse_bundle(&self, json: &str) -> Result<Bundle, FfiError>
pub fn parse_bundle(&self, json: &str) -> Result<Bundle, FfiError>
Parse a STIX bundle (consulting registered custom types) into a Bundle.
Sourcepub fn match_bundle(
&self,
pattern: &Pattern,
bundle: &Bundle,
) -> Result<MatchOutcome, FfiError>
pub fn match_bundle( &self, pattern: &Pattern, bundle: &Bundle, ) -> Result<MatchOutcome, FfiError>
Match a pattern against a bundle.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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