#[non_exhaustive]pub enum KnownPresent {
Single(String),
Multiple(Vec<String>),
}Expand description
Known-present declaration on a Site.
In JSON this is untagged: a plain string "torvalds" deserialises
into KnownPresent::Single, an array ["torvalds", "leomessi"]
into KnownPresent::Multiple. Serialisation preserves the form
the site was authored with, so single-username entries stay
compact.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Single(String)
Exactly one candidate username.
Multiple(Vec<String>)
Two or more candidate usernames. Doctor passes if any resolve
to Found.
Implementations§
Source§impl KnownPresent
impl KnownPresent
Sourcepub fn as_slice(&self) -> &[String]
pub fn as_slice(&self) -> &[String]
View all candidate usernames as a slice, in declaration order.
Always non-empty for Single; may be empty for a hand-authored
Multiple([]) (validation rejects that).
Sourcepub fn primary(&self) -> Option<&str>
pub fn primary(&self) -> Option<&str>
Primary candidate — the first declared username. Single
always has one; Multiple may be empty if a contributor wrote
[] (caught by Site::validate).
Trait Implementations§
Source§impl Clone for KnownPresent
impl Clone for KnownPresent
Source§fn clone(&self) -> KnownPresent
fn clone(&self) -> KnownPresent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnownPresent
impl Debug for KnownPresent
Source§impl<'de> Deserialize<'de> for KnownPresent
impl<'de> Deserialize<'de> for KnownPresent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<&str> for KnownPresent
impl From<&str> for KnownPresent
Source§impl From<String> for KnownPresent
impl From<String> for KnownPresent
Auto Trait Implementations§
impl Freeze for KnownPresent
impl RefUnwindSafe for KnownPresent
impl Send for KnownPresent
impl Sync for KnownPresent
impl Unpin for KnownPresent
impl UnsafeUnpin for KnownPresent
impl UnwindSafe for KnownPresent
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
Mutably borrows from an owned value. Read more