Skip to content

Use anyhow #257

@dlen

Description

@dlen

Hello!

I'm trying to update my code to version 0.5 but I'm having issues using anyhow.

I managed to reproduce it using the code in the examples. Just modifying the send_email signature:

pub async fn send_email(job: Email) -> anyhow::Result<()> {
    log::info!("Attempting to send email to {}", job.to);
    Ok(())
}

Outputs the following when building the actix-web example:

error[E0277]: the trait bound `ServiceFn<fn(Email) -> impl futures::Future<Output = Result<(), anyhow::Error>> {send_email}, _>: tower_service::Service<apalis::prelude::Request<_>>` is not satisfied
  --> examples/actix-web/src/main.rs:48:18
   |
48 |                 .build_fn(send_email)
   |                  ^^^^^^^^ the trait `tower_service::Service<apalis::prelude::Request<_>>` is not implemented for `ServiceFn<fn(Email) -> impl futures::Future<Output = Result<(), anyhow::Error>> {s
end_email}, _>`

I'm not sure if this is still possible to do or I'm missing something. In any case thanks a lot for the efforts in building this library!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions