#[non_exhaustive]pub enum ExternalPlatform {
GitHub,
Twitter,
Mastodon,
Telegram,
Other(String),
}Expand description
External identity provider.
Well-known platforms have dedicated variants so pattern-matching
is concise; unknown ones are preserved verbatim through
Self::Other to honour NIP-39’s “SHOULD process any i tags
with more than 2 values for future extensibility”.
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.
GitHub
github — proof is a Gist id under the same username.
twitter — proof is a tweet id under the same handle.
Mastodon
mastodon — identity carries <instance>/@<username>; proof
is a status id on that instance.
Telegram
telegram — proof is <channel>/<message-id>.
Other(String)
Any other platform name. Per NIP-39 §31 the name MAY contain
a-z, 0-9, and ._-/ and MUST NOT contain :. The
constructor ExternalPlatform::parse enforces that.
Implementations§
Source§impl ExternalPlatform
impl ExternalPlatform
Sourcepub fn parse(name: &str) -> Result<Self, Nip39Error>
pub fn parse(name: &str) -> Result<Self, Nip39Error>
Parse a platform name (the part before the colon in
<platform>:<identity>).
§Errors
Nip39Error::EmptyPlatformfor"".Nip39Error::PlatformContainsColonwhen the name contains the:separator (which would conflate the platform name with the identity).
Trait Implementations§
Source§impl Clone for ExternalPlatform
impl Clone for ExternalPlatform
Source§fn clone(&self) -> ExternalPlatform
fn clone(&self) -> ExternalPlatform
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 ExternalPlatform
impl Debug for ExternalPlatform
Source§impl Display for ExternalPlatform
impl Display for ExternalPlatform
impl Eq for ExternalPlatform
Source§impl Hash for ExternalPlatform
impl Hash for ExternalPlatform
Source§impl Ord for ExternalPlatform
impl Ord for ExternalPlatform
Source§fn cmp(&self, other: &ExternalPlatform) -> Ordering
fn cmp(&self, other: &ExternalPlatform) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ExternalPlatform
impl PartialEq for ExternalPlatform
Source§impl PartialOrd for ExternalPlatform
impl PartialOrd for ExternalPlatform
impl StructuralPartialEq for ExternalPlatform
Auto Trait Implementations§
impl Freeze for ExternalPlatform
impl RefUnwindSafe for ExternalPlatform
impl Send for ExternalPlatform
impl Sync for ExternalPlatform
impl Unpin for ExternalPlatform
impl UnsafeUnpin for ExternalPlatform
impl UnwindSafe for ExternalPlatform
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.