pub struct Identifier { /* private fields */ }Expand description
A STIX 2.1 compliant identifier that uniquely identifies a STIX Object.
It consists of two parts, the object-type and a UUID. The object type must exactly match the type property of the object being identified or referenced. The UUID is either an RFC 9562 compliant UUIDv4 or UUIDv5. The latter is used only for Cyber-observable objects. Other objects SHOULD use UUIDv4.
Identifier impl’s Display and FromStr, and its String representation is {object-type}–{UUID}
For more information see https://docs.oasis-open.org/cti/stix/v2.1/os/stix-v2.1-os.html#_64yvzeku5a5c
Implementations§
Source§impl Identifier
impl Identifier
Sourcepub fn new(object_type: &str) -> Result<Self, Error>
pub fn new(object_type: &str) -> Result<Self, Error>
Create a UUIDv4 identifier, used for any Stix Object that is not a Cyber-observable object. For SCOs, generates a UUIDv5 with empty properties as a fallback (legacy behavior for test IDs and refs). The builder path uses UUIDv4 when no contributing properties exist, per STIX 2.1 spec section 2.9.
Sourcepub fn new_v4(object_type: &str) -> Result<Self, Error>
pub fn new_v4(object_type: &str) -> Result<Self, Error>
Create a UUIDv4 identifier. For SCOs, this is the spec-compliant fallback when no ID contributing properties are present (STIX 2.1 spec section 2.9).
Sourcepub fn new_v5<T: Serialize>(
object_type: &str,
contributing_properties: &HashMap<String, T>,
) -> Result<Self, Error>
pub fn new_v5<T: Serialize>( object_type: &str, contributing_properties: &HashMap<String, T>, ) -> Result<Self, Error>
Create a UUIDv5 identifier using the STIX 2.1 preferred namespace, used ONLY for Cyber-observable Objects The value of the name portion should be the list of “ID Contributing Properties” (property-name and property value pairs), as defined on each object.
Trait Implementations§
Source§impl Clone for Identifier
impl Clone for Identifier
Source§impl Debug for Identifier
impl Debug for Identifier
Source§impl Default for Identifier
impl Default for Identifier
Source§impl<'de> Deserialize<'de> for Identifier
impl<'de> Deserialize<'de> for Identifier
Source§fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Identifier
impl Display for Identifier
impl Eq for Identifier
Source§impl FromStr for Identifier
impl FromStr for Identifier
Source§impl PartialEq for Identifier
impl PartialEq for Identifier
Source§impl Serialize for Identifierwhere
Self: Display,
impl Serialize for Identifierwhere
Self: Display,
Source§impl Stix for Identifier
impl Stix for Identifier
Source§fn check(&self, ctx: &mut CheckContext) -> Result<(), Error>
fn check(&self, ctx: &mut CheckContext) -> Result<(), Error>
Source§fn stix_check(&self) -> Result<(), Error>
fn stix_check(&self) -> Result<(), Error>
Stix::check and discards warnings.