pub struct ResourceIdentifier { /* private fields */ }
Expand description
A common format for wrapping existing unique identifiers to provide additional context.
Resource identifiers contain 4 components, prefixed by a format identifier ri
, and separated with periods:
ri.<service>.<instance>.<type>.<locator>
.
- Service: The service or application that namespaces the rest of the identifier. Must conform to the regex pattern
[a-z][a-z0-9\-]*
. - Instance: An optionally empty string that represents the specific service cluster, to allow for disambiduation of
artifacts from different service clusters. Must conform to the regex pattern
([a-z0-9][a-z0-9\-]*)?
. - Type: A service-specific resource type to namespace a group of locators. Must conform to the regex pattern
[a-z][a-z0-9\-\._]+
. - Locator: A string used to uniquely locate the specific resource. Must conform to the regex pattern
[a-zA-Z0-9\-\._]+
.
Implementations§
source§impl ResourceIdentifier
impl ResourceIdentifier
sourcepub fn new(s: &str) -> Result<ResourceIdentifier, ParseError>
pub fn new(s: &str) -> Result<ResourceIdentifier, ParseError>
Creates a resource identifier from a string.
This function behaves identically to ResourceIdentifier
’s FromStr
implementation.
sourcepub fn from_components(
service: &str,
instance: &str,
type_: &str,
locator: &str
) -> Result<ResourceIdentifier, ParseError>
pub fn from_components(
service: &str,
instance: &str,
type_: &str,
locator: &str
) -> Result<ResourceIdentifier, ParseError>
Creates a resource identifier from its individual components.
sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the resource identifier, returning its owned string representation.
Trait Implementations§
source§impl AsRef<str> for ResourceIdentifier
impl AsRef<str> for ResourceIdentifier
source§impl Borrow<str> for ResourceIdentifier
impl Borrow<str> for ResourceIdentifier
source§impl Clone for ResourceIdentifier
impl Clone for ResourceIdentifier
source§fn clone(&self) -> ResourceIdentifier
fn clone(&self) -> ResourceIdentifier
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ResourceIdentifier
impl Debug for ResourceIdentifier
source§impl<'de> Deserialize<'de> for ResourceIdentifier
impl<'de> Deserialize<'de> for ResourceIdentifier
source§fn deserialize<D>(d: D) -> Result<ResourceIdentifier, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<ResourceIdentifier, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ResourceIdentifier
impl Display for ResourceIdentifier
source§impl FromPlain for ResourceIdentifier
impl FromPlain for ResourceIdentifier
source§impl FromStr for ResourceIdentifier
impl FromStr for ResourceIdentifier
§type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
source§fn from_str(s: &str) -> Result<ResourceIdentifier, ParseError>
fn from_str(s: &str) -> Result<ResourceIdentifier, ParseError>
Parses a string
s
to return a value of this type. Read moresource§impl Hash for ResourceIdentifier
impl Hash for ResourceIdentifier
source§impl Ord for ResourceIdentifier
impl Ord for ResourceIdentifier
source§fn cmp(&self, other: &ResourceIdentifier) -> Ordering
fn cmp(&self, other: &ResourceIdentifier) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<ResourceIdentifier> for ResourceIdentifier
impl PartialEq<ResourceIdentifier> for ResourceIdentifier
source§fn eq(&self, other: &ResourceIdentifier) -> bool
fn eq(&self, other: &ResourceIdentifier) -> bool
source§impl PartialOrd<ResourceIdentifier> for ResourceIdentifier
impl PartialOrd<ResourceIdentifier> for ResourceIdentifier
source§fn partial_cmp(&self, other: &ResourceIdentifier) -> Option<Ordering>
fn partial_cmp(&self, other: &ResourceIdentifier) -> Option<Ordering>
source§fn gt(&self, other: &ResourceIdentifier) -> bool
fn gt(&self, other: &ResourceIdentifier) -> bool
source§fn ge(&self, other: &ResourceIdentifier) -> bool
fn ge(&self, other: &ResourceIdentifier) -> bool
This method tests greater than or equal to (for
self
and other
) and is used by the >=
operator. Read more