Trait webfinger::Resolver [−][src]
pub trait Resolver<R> { fn instance_domain<'a>() -> &'a str; fn find(acct: String, resource_repo: R) -> Result<Webfinger, ResolverError>; fn endpoint<T: Into<String>>(
resource: T,
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>() -> &'a str
Returns the domain name of the current instance.
fn find(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
.
Provided Methods
fn endpoint<T: Into<String>>(
resource: T,
resource_repo: R
) -> Result<Webfinger, ResolverError>
resource: T,
resource_repo: R
) -> Result<Webfinger, ResolverError>
Returns a WebFinger result for a requested resource.