Skip to main content

EffectKey

Struct EffectKey 

Source
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: String

Implementations§

Source§

impl EffectKey

Source

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.

Source

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).

Source

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.

Source

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 Clone for EffectKey

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EffectKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EffectKey

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for EffectKey

Source§

impl Hash for EffectKey

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for EffectKey

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for EffectKey

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EffectKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.