Skip to main content

Depth

Enum Depth 

Source
pub enum Depth {
    Unconstrained,
    Limit(usize),
}
Expand description

Trust depth.

A certification may include a trust signature subpacket, which specifies that the issuer not only considers the target binding to be correct, but that they are also willing to rely on certifications that the target certificate makes. That is, if Alice designates Bob as a trusted introducer, than if Carol is willing to rely on Alice’s certifications, she should also be willing to rely on Bob’s.

The trust depth is one of two parameters stored in the trust signature subpacket, and indicates how far that capability may be delegated. A value of zero means that the certification is actually a normal certification, and the target is not a trusted introducer. A value of one means that the target certificate should be considered a trusted introducer, but it may not further delegate that capability. A value of two means that the target certificate should be considered a trusted introducer, and that it may delegate that capability to another certificate, but they may not further delegate it. In short, a value of n means that there may be up to n intervening trusted introducers between the issuer and the target binding:

  • 0: Normal certification.
  • 1: Trusted introducer.
  • 2: Meta-introducer.
  • etc.

A value of 255, the maximum value that can be stored in the OpenPGP data structure, has a special meaning: the issuer does not impose a constraint on the number of delegations.

This data structure does not automatically convert a value of 255 to Depth::Unconstrained; the caller must specify Depth::Unconstrained explicitly.

Variants§

§

Unconstrained

§

Limit(usize)

Implementations§

Source§

impl Depth

Source

pub fn new<I>(depth: I) -> Self
where I: Into<Option<usize>>,

Source

pub fn unconstrained() -> Self

Returns an unconstrained Depth.

Source

pub fn is_unconstrained(&self) -> bool

Returns whether this Depth is unconstrained.

Source

pub fn can_introduce(&self) -> bool

Returns whether this Depth allows introducing.

Source

pub fn limit(&self) -> Option<usize>

Converts the Depth to an Option<usize>.

An unconstrained depth is converted to None. A constrained depth of d is converted to Some(d).

Source

pub fn decrease(&self, value: usize) -> Depth

Decreases the depth by value.

The depth must be at least as large as value. If the depth is unconstrained, decreasing the depth doesn’t do anything.

Trait Implementations§

Source§

impl Clone for Depth

Source§

fn clone(&self) -> Depth

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 Copy for Depth

Source§

impl Debug for Depth

Source§

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

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

impl Display for Depth

Source§

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

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

impl Eq for Depth

Source§

impl From<Option<usize>> for Depth

Source§

fn from(d: Option<usize>) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Depth

Source§

fn from(d: usize) -> Self

Converts to this type from the input type.
Source§

impl Ord for Depth

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Depth

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 PartialOrd for Depth

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl Freeze for Depth

§

impl RefUnwindSafe for Depth

§

impl Send for Depth

§

impl Sync for Depth

§

impl Unpin for Depth

§

impl UnsafeUnpin for Depth

§

impl UnwindSafe for Depth

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.