Skip to main content

stix/
lib.rs

1//! Umbrella crate for the **stix-rust** toolkit.
2//!
3//! Re-exports the parser ([`pattern`]), object model ([`model`]), and matcher
4//! ([`matcher`]) so downstream code can depend on a single crate.
5//!
6//! # Example
7//!
8//! ```
9//! use stix::parse;
10//! use stix::matcher::match_scos;
11//! use stix::model::StixObject;
12//!
13//! let pattern = parse("[ipv4-addr:value = '198.51.100.1']").unwrap();
14//! let sco = StixObject::from_json(serde_json::json!({
15//!     "type": "ipv4-addr", "id": "ipv4-addr--1", "value": "198.51.100.1"
16//! })).unwrap();
17//! assert!(match_scos(&pattern, &[sco]).unwrap().is_match());
18//! ```
19
20#![warn(missing_docs)]
21
22pub use stix_matcher as matcher;
23pub use stix_model as model;
24pub use stix_pattern as pattern;
25
26/// Parse a STIX pattern string into an AST (re-export of [`stix_pattern::parse`]).
27pub use stix_pattern::parse;
28
29/// The high-level matching entry points.
30pub use stix_matcher::{match_bundle, match_observations, match_observed_data, match_scos};