#[non_exhaustive]pub struct Discovery {
pub links: Vec<DiscoveryLink>,
}Expand description
A NodeInfo discovery document, served at /.well-known/nodeinfo.
Points clients at one or more versioned NodeInfo schema documents. At
least one link should be present; clients typically pick the most
recent version they support.
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.links: Vec<DiscoveryLink>Links to specific schema documents.
Implementations§
Source§impl Discovery
impl Discovery
Sourcepub fn for_version(version: Version, href: Url) -> Self
pub fn for_version(version: Version, href: Url) -> Self
Creates a discovery document advertising a single NodeInfo endpoint.
§Examples
let disco = Discovery::for_version(
Version::V2_1,
"https://example.com/nodeinfo/2.1".parse().unwrap(),
);
assert_eq!(disco.links.len(), 1);Sourcepub fn with_version(self, version: Version, href: Url) -> Self
pub fn with_version(self, version: Version, href: Url) -> Self
Appends another version endpoint and returns self for chaining.
Sourcepub fn preferred_link(&self) -> Option<&DiscoveryLink>
pub fn preferred_link(&self) -> Option<&DiscoveryLink>
Returns the link with the highest advertised NodeInfo version this
crate understands.
Prefers 2.1 over 2.0; returns None if no recognised schema rel is
present.
Sourcepub fn find_link(&self, version: Version) -> Option<&DiscoveryLink>
pub fn find_link(&self, version: Version) -> Option<&DiscoveryLink>
Returns the link matching the given version, if any.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Discovery
impl<'de> Deserialize<'de> for Discovery
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
impl Eq for Discovery
impl StructuralPartialEq for Discovery
Auto Trait Implementations§
impl Freeze for Discovery
impl RefUnwindSafe for Discovery
impl Send for Discovery
impl Sync for Discovery
impl Unpin for Discovery
impl UnsafeUnpin for Discovery
impl UnwindSafe for Discovery
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.