Skip to main content

ObjectView

Trait ObjectView 

Source
pub trait ObjectView {
    // Required methods
    fn id(&self) -> Option<&str>;
    fn type_(&self) -> Option<&str>;
    fn property(&self, name: &str) -> Option<StixValue>;
}
Expand description

A read-only, type-agnostic view over a STIX object.

property returns an owned StixValue so typed objects can synthesize values on demand without storing every field twice. The matcher consumes only this trait, so it never needs to branch on typed vs. generic objects.

Required Methods§

Source

fn id(&self) -> Option<&str>

The object’s STIX id, if it has one.

Source

fn type_(&self) -> Option<&str>

The object’s STIX type, if it has one.

Source

fn property(&self, name: &str) -> Option<StixValue>

The named top-level property as an owned value, or None if absent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§