[][src]Trait webfinger::Resolver

pub trait Resolver<R> {
    fn instance_domain<'a>(&self) -> &'a str;
fn find(
        &self,
        prefix: Prefix,
        acct: String,
        resource_repo: R
    ) -> Result<Webfinger, ResolverError>; fn endpoint(
        &self,
        resource: impl Into<String>,
        resource_repo: R
    ) -> Result<Webfinger, ResolverError> { ... } }

A trait to easily generate a WebFinger endpoint for any resource repository.

The R type is your resource repository (a database for instance) that will be passed to the find and endpoint functions.

Required methods

fn instance_domain<'a>(&self) -> &'a str

Returns the domain name of the current instance.

fn find(
    &self,
    prefix: Prefix,
    acct: String,
    resource_repo: R
) -> Result<Webfinger, ResolverError>

Tries to find a resource, acct, in the repository resource_repo.

acct is not a complete acct: URI, it only contains the identifier of the requested resource (e.g. test for acct:test@example.org)

If the resource couldn't be found, you may probably want to return a ResolverError::NotFound.

Loading content...

Provided methods

fn endpoint(
    &self,
    resource: impl Into<String>,
    resource_repo: R
) -> Result<Webfinger, ResolverError>

Returns a WebFinger result for a requested resource.

Loading content...

Implementors

Loading content...