Skip to main content

ServiceDocument

Struct ServiceDocument 

pub struct ServiceDocument {
    pub version: u32,
    pub server_name: String,
    pub directory: String,
    pub relay: String,
    pub accounts: String,
    pub provisioning: String,
    pub tls: Tls,
    pub ws: Option<String>,
}
Expand description

The document itself. The four services are host:port strings, resolved by the reader; server_name is the name the TLS certificate presents, which is the host in every deployment so far but is carried separately so that it need not be.

Fields§

§version: u32

The document’s own format version; see [VERSION].

§server_name: String

The name the server’s TLS certificate presents.

§directory: String

The directory service, as host:port.

§relay: String

The relay, as host:port.

§accounts: String

The account service, as host:port.

§provisioning: String

The provisioning service, as host:port.

§tls: Tls

How to trust the server.

§ws: Option<String>

The WebSocket base URL, if the deployment offers one; see the module documentation. Absent from documents written before it existed.

Implementations§

§

impl ServiceDocument

pub fn hosted(host: &str) -> ServiceDocument

The four services on host, on the default ports, over web-PKI TLS presenting host: a hosted deployment.

pub fn local(host: &str) -> ServiceDocument

The four services on host, on the default ports, without TLS: a development server on loopback.

pub fn on( host: &str, server_name: &str, ports: [u16; 4], tls: Tls, ) -> ServiceDocument

The four services on host at ports (directory, relay, accounts, provisioning), trusted as tls under server_name.

pub fn with_ws(self, ws: &str) -> ServiceDocument

The same document, offering the WebSocket carriage at ws (a base URL such as wss://tacenta.com/v1/ws, without a trailing slash).

pub fn ws_url(&self, service: &str) -> Option<String>

The WebSocket URL for one service (directory, relay, accounts, provisioning), if the document offers the carriage.

pub fn endpoints(&self) -> [&str; 4]

The four host:port entries, in the order directory, relay, accounts, provisioning.

Trait Implementations§

§

impl Clone for ServiceDocument

§

fn clone(&self) -> ServiceDocument

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
§

impl Debug for ServiceDocument

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for ServiceDocument

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ServiceDocument, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Eq for ServiceDocument

§

impl PartialEq for ServiceDocument

§

fn eq(&self, other: &ServiceDocument) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for ServiceDocument

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl StructuralPartialEq for ServiceDocument

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
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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V