pub struct Uris { /* private fields */ }Expand description
The URIs of what a federation serves, in one origin, built from the templates their routes were registered with.
Federation::uris gives them where there is no request, and
Context::uris within one. They carry none of the application’s data
and are cheap to clone, so an application can keep them in its own
state, for code that runs outside any request: creating an account,
sending a post from a background job. An application serving several
hosts keeps one and takes each tenant’s with Uris::with_origin.
Implementations§
Source§impl Uris
impl Uris
Sourcepub fn with_origin(&self, origin: Url) -> Self
pub fn with_origin(&self, origin: Url) -> Self
The same URIs, in origin.
Sourcepub fn actor_uri(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
pub fn actor_uri(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
The URI of the actor of kind with identifier.
§Errors
When no actor dispatcher is of kind, or identifier is empty for a
template that needs one.
Sourcepub fn key_id(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
pub fn key_id(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
The ID of the key the actor of kind with identifier signs with:
its IRI with the fragment main-key, as Mastodon names it, and as
the actor document should publish it.
§Errors
As Uris::actor_uri.
Sourcepub fn object_uri(
&self,
kind: &str,
values: &[(&str, &str)],
) -> Result<Url, UriError>
pub fn object_uri( &self, kind: &str, values: &[(&str, &str)], ) -> Result<Url, UriError>
The URI of the object of kind with values.
§Errors
When no object dispatcher is of kind, or values do not fill its
template.
Sourcepub fn collection_uri(
&self,
kind: &str,
identifier: &str,
) -> Result<Url, UriError>
pub fn collection_uri( &self, kind: &str, identifier: &str, ) -> Result<Url, UriError>
The URI of the collection kind of what identifier names.
§Errors
As Uris::actor_uri, for collections.
Sourcepub fn inbox_uri(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
pub fn inbox_uri(&self, kind: &str, identifier: &str) -> Result<Url, UriError>
The URI of the inbox of the actor of kind with identifier.
§Errors
When no inbox is registered for kind, or identifier does not fill
its template.