Skip to main content

FeedHandler

Type Alias FeedHandler 

Source
pub type FeedHandler = Arc<dyn Fn(FeedRequest, AppState) -> Pin<Box<dyn Future<Output = Result<FeedSkeleton, XrpcError>> + Send>> + Send + Sync>;
Expand description

A feed handler function.

Takes a FeedRequest and AppState, returning a future that resolves to a FeedSkeleton or an [XrpcError].

Construct one by wrapping an async function with Arc:

let handler: FeedHandler = Arc::new(|req, state| {
    Box::pin(async move {
        Ok(FeedSkeleton { feed: vec![], cursor: None })
    })
});

Aliased Type§

pub struct FeedHandler { /* private fields */ }