pub struct TrustDomain { /* private fields */ }Expand description
A validated SPIFFE trust domain.
A TrustDomain represents the authority component of a SPIFFE ID and
is guaranteed to contain only characters allowed by the SPIFFE
specification:
https://github.com/spiffe/spiffe/blob/main/standards/SPIFFE-ID.md#21-trust-domain.
Implementations§
Source§impl TrustDomain
impl TrustDomain
Sourcepub fn new(id_or_name: impl AsRef<str>) -> Result<TrustDomain, SpiffeIdError>
pub fn new(id_or_name: impl AsRef<str>) -> Result<TrustDomain, SpiffeIdError>
Attempts to parse a TrustDomain instance from the given name or spiffe_id string.
§Arguments
id_or_name- Name of a trust domain, it also can be a SPIFFE ID string from which the domain name is extracted.
§Errors
If the function cannot parse the input as a Trust domain, a SpiffeIdError variant will be returned.
§Examples
use spiffe::TrustDomain;
let trust_domain = TrustDomain::new("domain.test").unwrap();
assert_eq!("domain.test", trust_domain.to_string());
assert_eq!("spiffe://domain.test", trust_domain.id_string());
let trust_domain = TrustDomain::new("spiffe://example.org/path").unwrap();
assert_eq!("example.org", trust_domain.to_string());
assert_eq!("spiffe://example.org", trust_domain.id_string());Trait Implementations§
Source§impl AsRef<str> for TrustDomain
impl AsRef<str> for TrustDomain
Source§impl Clone for TrustDomain
impl Clone for TrustDomain
Source§fn clone(&self) -> TrustDomain
fn clone(&self) -> TrustDomain
Returns a duplicate 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 TrustDomain
impl Debug for TrustDomain
Source§impl Display for TrustDomain
impl Display for TrustDomain
Source§impl FromStr for TrustDomain
impl FromStr for TrustDomain
Source§type Err = SpiffeIdError
type Err = SpiffeIdError
The associated error which can be returned from parsing.
Source§fn from_str(name: &str) -> Result<TrustDomain, <TrustDomain as FromStr>::Err>
fn from_str(name: &str) -> Result<TrustDomain, <TrustDomain as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for TrustDomain
impl Hash for TrustDomain
Source§impl Ord for TrustDomain
impl Ord for TrustDomain
Source§fn cmp(&self, other: &TrustDomain) -> Ordering
fn cmp(&self, other: &TrustDomain) -> 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 for TrustDomain
impl PartialEq for TrustDomain
Source§impl PartialOrd for TrustDomain
impl PartialOrd for TrustDomain
Source§impl TryFrom<&str> for TrustDomain
impl TryFrom<&str> for TrustDomain
Source§type Error = SpiffeIdError
type Error = SpiffeIdError
The type returned in the event of a conversion error.
Source§fn try_from(
name: &str,
) -> Result<TrustDomain, <TrustDomain as TryFrom<&str>>::Error>
fn try_from( name: &str, ) -> Result<TrustDomain, <TrustDomain as TryFrom<&str>>::Error>
Performs the conversion.
Source§impl TryFrom<String> for TrustDomain
impl TryFrom<String> for TrustDomain
Source§type Error = SpiffeIdError
type Error = SpiffeIdError
The type returned in the event of a conversion error.
Source§fn try_from(
value: String,
) -> Result<TrustDomain, <TrustDomain as TryFrom<String>>::Error>
fn try_from( value: String, ) -> Result<TrustDomain, <TrustDomain as TryFrom<String>>::Error>
Performs the conversion.
impl Eq for TrustDomain
impl StructuralPartialEq for TrustDomain
Auto Trait Implementations§
impl Freeze for TrustDomain
impl RefUnwindSafe for TrustDomain
impl Send for TrustDomain
impl Sync for TrustDomain
impl Unpin for TrustDomain
impl UnwindSafe for TrustDomain
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request