pub struct WellKnownDocument { /* private fields */ }Expand description
A validated .well-known/tea document.
Implementations§
Source§impl WellKnownDocument
impl WellKnownDocument
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, ModelError>
pub fn parse(bytes: &[u8]) -> Result<Self, ModelError>
Parse and validate a well-known document.
§Errors
Returns an error when the JSON is not a schema version 1 document.
Sourcepub fn parse_lenient(bytes: &[u8]) -> Result<Self, ModelError>
pub fn parse_lenient(bytes: &[u8]) -> Result<Self, ModelError>
Like Self::parse, but also accepts short API versions such as 1
and 1.0 (see ApiVersion::parse_lenient).
§Errors
Returns an error when the JSON is not a schema version 1 document.
Sourcepub fn endpoints(&self) -> &[WellKnownEndpoint]
pub fn endpoints(&self) -> &[WellKnownEndpoint]
Endpoints in document order.
Sourcepub fn select(
&self,
supported: &SupportedApi,
) -> Result<Vec<SelectedEndpoint>, ModelError>
pub fn select( &self, supported: &SupportedApi, ) -> Result<Vec<SelectedEndpoint>, ModelError>
Order endpoints for connection attempts.
§Errors
Returns an error when none advertise a supported version.
Trait Implementations§
Source§impl Clone for WellKnownDocument
impl Clone for WellKnownDocument
Source§impl Debug for WellKnownDocument
impl Debug for WellKnownDocument
impl Eq for WellKnownDocument
Source§impl PartialEq for WellKnownDocument
impl PartialEq for WellKnownDocument
impl StructuralPartialEq for WellKnownDocument
Auto Trait Implementations§
impl Forget for WellKnownDocument
impl Freeze for WellKnownDocument
impl RefUnwindSafe for WellKnownDocument
impl Send for WellKnownDocument
impl Sync for WellKnownDocument
impl Unpin for WellKnownDocument
impl UnsafeUnpin for WellKnownDocument
impl UnwindSafe for WellKnownDocument
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