pub struct Ref<'id, 'collection: 'id, D> { /* private fields */ }
Expand description
An ID for a resource that may be in the backing collection.
Ref
is used to allow exploration of STIX collections when not every object referenced is
present in-memory.
Implementations§
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Declaration>
The ID of a STIX object of some type which may be present in the collection.
impl<'id, 'collection: 'id> Ref<'id, 'collection, Declaration>
The ID of a STIX object of some type which may be present in the collection.
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, AttackPattern>
impl<'id, 'collection: 'id> Ref<'id, 'collection, AttackPattern>
pub fn resolve(self) -> Option<Node<'collection, AttackPattern>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, CourseOfAction>
impl<'id, 'collection: 'id> Ref<'id, 'collection, CourseOfAction>
pub fn resolve(self) -> Option<Node<'collection, CourseOfAction>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Malware>
impl<'id, 'collection: 'id> Ref<'id, 'collection, Malware>
Sourcepub fn resolve(self) -> Option<Node<'collection, Malware>>
pub fn resolve(self) -> Option<Node<'collection, Malware>>
Examples found in repository?
examples/actor_lookup.rs (line 18)
6fn display_actor<'a>(actor: &Node<'a, IntrusionSet>) {
7 println!("{} ({})", actor.name(), actor.id());
8 println!("============");
9
10 if let Some(description) = actor.description() {
11 println!("{}\n", description);
12 }
13
14 let mut malwares = actor.uses_malware().peekable();
15 if malwares.peek().is_some() {
16 println!("Malware:");
17 for malware in malwares {
18 match malware.resolve() {
19 Some(malware) => {
20 println!("- {} ({})", malware.name(), malware.id());
21 }
22 None => {
23 println!("- Unknown Malware");
24 }
25 }
26 }
27 }
28
29 let mut tools = actor.uses_tools().peekable();
30 if tools.peek().is_some() {
31 println!("Tools:");
32 for tool in tools {
33 match tool.resolve() {
34 Some(tool) => {
35 println!("- {} ({})", tool.name(), tool.id());
36 }
37 None => {
38 println!("- Unknown Tool");
39 }
40 }
41 }
42 }
43}
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Tool>
impl<'id, 'collection: 'id> Ref<'id, 'collection, Tool>
Sourcepub fn resolve(self) -> Option<Node<'collection, Tool>>
pub fn resolve(self) -> Option<Node<'collection, Tool>>
Examples found in repository?
examples/actor_lookup.rs (line 33)
6fn display_actor<'a>(actor: &Node<'a, IntrusionSet>) {
7 println!("{} ({})", actor.name(), actor.id());
8 println!("============");
9
10 if let Some(description) = actor.description() {
11 println!("{}\n", description);
12 }
13
14 let mut malwares = actor.uses_malware().peekable();
15 if malwares.peek().is_some() {
16 println!("Malware:");
17 for malware in malwares {
18 match malware.resolve() {
19 Some(malware) => {
20 println!("- {} ({})", malware.name(), malware.id());
21 }
22 None => {
23 println!("- Unknown Malware");
24 }
25 }
26 }
27 }
28
29 let mut tools = actor.uses_tools().peekable();
30 if tools.peek().is_some() {
31 println!("Tools:");
32 for tool in tools {
33 match tool.resolve() {
34 Some(tool) => {
35 println!("- {} ({})", tool.name(), tool.id());
36 }
37 None => {
38 println!("- Unknown Tool");
39 }
40 }
41 }
42 }
43}
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, IntrusionSet>
impl<'id, 'collection: 'id> Ref<'id, 'collection, IntrusionSet>
pub fn resolve(self) -> Option<Node<'collection, IntrusionSet>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Infrastructure>
impl<'id, 'collection: 'id> Ref<'id, 'collection, Infrastructure>
pub fn resolve(self) -> Option<Node<'collection, Infrastructure>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, MarkingDefinition>
impl<'id, 'collection: 'id> Ref<'id, 'collection, MarkingDefinition>
pub fn resolve(self) -> Option<Node<'collection, MarkingDefinition>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Relationship>
impl<'id, 'collection: 'id> Ref<'id, 'collection, Relationship>
pub fn resolve(self) -> Option<Node<'collection, Relationship>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, ThreatActor>
impl<'id, 'collection: 'id> Ref<'id, 'collection, ThreatActor>
pub fn resolve(self) -> Option<Node<'collection, ThreatActor>>
Source§impl<'id, 'collection: 'id> Ref<'id, 'collection, Vulnerability>
impl<'id, 'collection: 'id> Ref<'id, 'collection, Vulnerability>
pub fn resolve(self) -> Option<Node<'collection, Vulnerability>>
Trait Implementations§
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, AttackPattern>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, AttackPattern>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, CourseOfAction>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, CourseOfAction>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Infrastructure>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Infrastructure>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, IntrusionSet>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, IntrusionSet>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, MarkingDefinition>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, MarkingDefinition>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Relationship>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Relationship>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, ThreatActor>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, ThreatActor>
Source§impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Vulnerability>
impl<'id, 'collection: 'id> Resolve for Ref<'id, 'collection, Vulnerability>
Auto Trait Implementations§
impl<'id, 'collection, D> Freeze for Ref<'id, 'collection, D>
impl<'id, 'collection, D> RefUnwindSafe for Ref<'id, 'collection, D>where
D: RefUnwindSafe,
impl<'id, 'collection, D> Send for Ref<'id, 'collection, D>where
D: Send,
impl<'id, 'collection, D> Sync for Ref<'id, 'collection, D>where
D: Sync,
impl<'id, 'collection, D> Unpin for Ref<'id, 'collection, D>where
D: Unpin,
impl<'id, 'collection, D> UnwindSafe for Ref<'id, 'collection, D>where
D: UnwindSafe,
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