Skip to main content

PeerRecord

Struct PeerRecord 

Source
#[non_exhaustive]
pub struct PeerRecord { pub id: String, pub name: String, pub certificate: Option<PeerId>, pub pins: Vec<Pin>, pub email: Option<String>, pub groups: Vec<String>, pub disabled: bool, pub made_unix: Option<i64>, }
Expand description

One accepted peer as a [Table] keeps it, keyed by name.

It derives guatiao’s ToValue, FromValue and Schema, so a [Table] may keep it in any format.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: String

Stable identity; what a [Verdict::Valid] lookup names.

§name: String

The peer’s name; unique in the table.

§certificate: Option<PeerId>

The SHA-256 fingerprint of a certificate it pins: written in its canonical form, read in any spelling coqui-peer-tls reads. Absent for an account pinned by other means.

§pins: Vec<Pin>

Further pins, each naming its kind (fingerprint or key): with certificate, everything the account is known by. A certificate renewed on the same key keeps a key pin. An account holds at least one pin and at most the provider’s max_pins.

§email: Option<String>

Email address.

§groups: Vec<String>

Directory groups.

§disabled: bool

A disabled peer is refused.

§made_unix: Option<i64>

When it was accepted, in seconds since the Unix epoch.

Implementations§

Source§

impl PeerRecord

Source

pub fn new( id: impl Into<String>, name: impl Into<String>, certificate: &PeerId, ) -> Self

An enabled peer with no groups, accepted by this fingerprint.

Source

pub fn keyed(id: impl Into<String>, name: impl Into<String>, pin: Pin) -> Self

An enabled peer with no groups, accepted by pin: a public key, say, so a renewed certificate on the same key signs in.

Source

pub fn groups(self, groups: impl IntoIterator<Item = impl Into<String>>) -> Self

Sets the directory groups.

Source

pub fn email(self, email: impl Into<String>) -> Self

Sets the email address.

Source

pub fn disabled(self, disabled: bool) -> Self

Sets whether the peer is disabled.

Trait Implementations§

Source§

impl Clone for PeerRecord

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 PeerRecord

Source§

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

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

impl Eq for PeerRecord

Source§

impl FromValue for PeerRecord

Source§

const KINDS: Kinds = ::coqui_access::guatiao::Kinds::MAP

The kinds from_value may accept; any other is refused. Every impl in this crate and every derived one says; the default, [Kinds::ANY], claims every kind, which keeps a type that does not say out of an enum told apart by kind.
Source§

fn from_value(__value: &Value) -> Result<Self, MapError>

Performs the conversion. Read more
Source§

impl FromWalk for PeerRecord

Source§

fn from_walk<__W: Walker>(__walker: __W) -> Result<Self, MapError>

Reads Self from the one value walker holds.
Source§

impl Keyed for PeerRecord

Source§

fn key(&self) -> Cow<'_, str>

What identifies this record in its table: a put with the same key replaces it. Borrowed when the record holds it as text, owned when it is written from a value.
Source§

impl MapRead for PeerRecord

Source§

fn read_map<__M: MapWalker>(__entries: __M) -> Result<Self, MapError>

Reads every entry.
Source§

impl PartialEq for PeerRecord

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 Schema for PeerRecord

Source§

fn kind(__alloc: Alloc) -> KindBuilder

The kind describing values of this type.
§

fn schema_in(alloc: Alloc) -> Result<Value, ValueError>

The whole schema: the fields a consumer fills in, as a root document with its dialect declared. Read more
§

fn schema() -> Result<Value, ValueError>

The whole schema, built through the crate’s own allocator. See schema_in.
Source§

impl StructuralPartialEq for PeerRecord

Source§

impl ToValue for PeerRecord

Source§

fn to_value_in(&self, __alloc: Alloc) -> Result<Value, ValueError>

Performs the conversion through alloc. A derived struct produces a map.
§

fn to_value(&self) -> Result<Value, ValueError>

Performs the conversion through the crate’s own allocator.
Source§

impl Walk for PeerRecord

Source§

fn walk<__V: Visitor>(&self, __visitor: __V) -> Result<__V::Ok, __V::Error>

Hands this value to visitor: one call for a scalar; for a list or a map, the call that opens it, then each element, then end.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

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

§

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

Compare self to key and return true if they are equal.
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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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