Skip to main content

PacketKeyRing

Struct PacketKeyRing 

Source
pub struct PacketKeyRing { /* private fields */ }
Expand description

Bounded packet key lifecycle metadata.

Implementations§

Source§

impl PacketKeyRing

Source

pub fn new(config: PacketKeyRingConfig) -> Self

Creates an empty key ring.

Source

pub fn with_defaults() -> Self

Creates an empty key ring with default limits.

Source

pub const fn config(&self) -> PacketKeyRingConfig

Returns configuration.

Source

pub fn len(&self) -> usize

Returns key metadata count.

Source

pub fn is_empty(&self) -> bool

Returns whether the ring has no key metadata.

Source

pub const fn stats(&self) -> PacketKeyRingStats

Returns statistics.

Source

pub fn get(&self, key_id: u32) -> Option<PacketKeyDescriptor>

Returns one key descriptor.

Source

pub fn iter(&self) -> impl Iterator<Item = &PacketKeyDescriptor>

Iterates key descriptors in key-id order.

Source

pub fn insert( &mut self, descriptor: PacketKeyDescriptor, ) -> Result<(), PacketKeyRingError>

Inserts a descriptor if capacity and uniqueness allow it.

Source

pub fn insert_active( &mut self, key_id: u32, now: Tick, send_priority: u32, ) -> Result<(), PacketKeyRingError>

Inserts active key metadata.

Source

pub fn activate( &mut self, key_id: u32, activated_at: Tick, ) -> Result<(), PacketKeyRingError>

Marks a key active and send-eligible from activated_at.

Source

pub fn retire( &mut self, key_id: u32, retires_at: Tick, ) -> Result<(), PacketKeyRingError>

Marks a key receive-only for retirement.

Source

pub fn revoke(&mut self, key_id: u32) -> Result<(), PacketKeyRingError>

Marks a key rejected.

Source

pub fn set_expiry( &mut self, key_id: u32, expires_at: Option<Tick>, ) -> Result<(), PacketKeyRingError>

Updates the expiration tick for one key.

Source

pub fn remove_expired(&mut self, now: Tick) -> usize

Removes expired descriptors and returns the removed count.

Source

pub fn select_send_key( &self, now: Tick, ) -> Result<PacketKeyDescriptor, PacketKeyRingError>

Selects the best active key for sending at now.

Source

pub fn accept_key( &self, key_id: u32, now: Tick, ) -> Result<PacketKeyDescriptor, PacketKeyRingError>

Checks that key_id is accepted for receiving at now.

Trait Implementations§

Source§

impl Clone for PacketKeyRing

Source§

fn clone(&self) -> PacketKeyRing

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 PacketKeyRing

Source§

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

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

impl Default for PacketKeyRing

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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