pub struct EffectKey {
pub class: EffectClass,
pub target: String,
}Expand description
One effect of a call on one target.
The producer normalizes target: lowercase host:port for
EffectClass::Egress; an absolute, normalized path for
EffectClass::Delete, EffectClass::Write and
EffectClass::Configuration; the profile name for
EffectClass::Credential; the program name for EffectClass::Process.
Build keys with EffectKey::path, EffectKey::egress and
EffectKey::named so every producer uses the same convention.
Fields§
§class: EffectClass§target: StringImplementations§
Source§impl EffectKey
impl EffectKey
Sourcepub fn path(class: EffectClass, raw: &str) -> Option<EffectKey>
pub fn path(class: EffectClass, raw: &str) -> Option<EffectKey>
A path effect (Delete, Write, Configuration) on an absolute
path, normalized lexically: empty and . components dropped, ..
resolved, no trailing slash. None for a relative path or one that
climbs above /. The filesystem is not consulted (symlinks are not
resolved). A Windows path with a drive (C:\Users\x, c:/Users/x)
is absolute too, written C:/Users/x: \ and / both separate its
components, and the drive letter is uppercase.
Sourcepub fn egress(scheme: &str, host: &str, port: Option<u16>) -> EffectKey
pub fn egress(scheme: &str, host: &str, port: Option<u16>) -> EffectKey
An egress effect on host, with target host:port: the host
lowercased and without a trailing dot (h.example. is h.example),
and the port given or else the scheme’s default (http
80, https 443, ssh 22; 0 for an unknown scheme).
Sourcepub fn named(class: EffectClass, name: &str) -> EffectKey
pub fn named(class: EffectClass, name: &str) -> EffectKey
An effect named by an identifier rather than a path or host: the
profile name for EffectClass::Credential, the program name for
EffectClass::Process.
Sourcepub fn overlaps(&self, other: &EffectKey) -> bool
pub fn overlaps(&self, other: &EffectKey) -> bool
Same class, and the same target or, for path classes, one target is
the other or below it. Targets are compared as given, so both keys
must be normalized (built with EffectKey::path,
EffectKey::egress or EffectKey::named): h.example.invalid
does not overlap h.example.invalid:443, and /a/../b does not
overlap /b.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EffectKey
impl<'de> Deserialize<'de> for EffectKey
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EffectKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EffectKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for EffectKey
Source§impl Serialize for EffectKey
impl Serialize for EffectKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for EffectKey
Auto Trait Implementations§
impl Forget for EffectKey
impl Freeze for EffectKey
impl Move for EffectKey
impl RefUnwindSafe for EffectKey
impl Send for EffectKeywhere
RawVecInner: Send,
impl Sync for EffectKeywhere
RawVecInner: Sync,
impl Unpin for EffectKey
impl UnsafeUnpin for EffectKey
impl UnwindSafe for EffectKeywhere
RawVecInner: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more