Pass an owned FromRequest value

This commit is contained in:
asonix 2020-03-15 20:17:51 -05:00
parent 779b26e52e
commit 755ab59d4c
4 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "actix-webfinger"
description = "Types and helpers to create and fetch Webfinger resources"
version = "0.3.0-alpha.0"
version = "0.3.0-alpha.1"
license = "GPL-3.0"
authors = ["asonix <asonix@asonix.dog>"]
repository = "https://git.asonix.dog/Aardwolf/actix-webfinger"

View file

@ -15,7 +15,7 @@ First, add Actix Webfinger as a dependency
[dependencies]
actix = "0.10.0-alpha.1"
actix-web = "3.0.0-alpha.1"
actix-webfinger = "0.3.0-alpha.0"
actix-webfinger = "0.3.0-alpha.1"
```
Then use it in your application

View file

@ -15,7 +15,7 @@ impl Resolver<Data<MyState>> for MyResolver {
fn find(
account: &str,
domain: &str,
state: &Data<MyState>,
state: Data<MyState>,
) -> Pin<Box<dyn Future<Output = Result<Option<Webfinger>, Self::Error>>>> {
let w = if domain == state.domain {
Some(Webfinger::new(&format!("{}@{}", account, domain)))

View file

@ -15,7 +15,7 @@
//! [dependencies]
//! actix = "0.10.0-alpha.1"
//! actix-web = "3.0.0-alpha.1"
//! actix-webfinger = "0.3.0-alpha.0"
//! actix-webfinger = "0.3.0-alpha.1"
//! ```
//!
//! Then use it in your application
@ -55,7 +55,7 @@
//! fn find(
//! account: &str,
//! domain: &str,
//! state: &Data<MyState>,
//! state: S,
//! ) -> Pin<Box<dyn Future<Output = Result<Option<Webfinger>, Self::Error>>>> {
//! let w = if domain == state.domain {
//! Some(Webfinger::new(&format!("{}@{}", account, domain)))
@ -356,7 +356,7 @@ where
fn find(
account: &str,
domain: &str,
state: &S,
state: S,
) -> Pin<Box<dyn Future<Output = Result<Option<Webfinger>, Self::Error>>>>;
fn endpoint(
@ -365,7 +365,7 @@ where
let WebfingerResource { account, domain } = query.into_inner().resource;
Box::pin(async move {
match Self::find(&account, &domain, &state).await? {
match Self::find(&account, &domain, state).await? {
Some(w) => Ok(w.respond()),
None => Ok(HttpResponse::NotFound().finish()),
}