kilork / actix-web-static-files

actix-web static files as resources support
The Unlicense
75 stars 18 forks source link

Actix_web 4.0 compatibility: trait `HttpServiceFactory` is not implemented for `ResourceFiles` #47

Closed joepio closed 2 years ago

joepio commented 2 years ago

Hi there, thanks for creating and maintaining this!

I'd like to use this in a project, but it seems like it's not yet compatible with the latest Betas of actix.

The error I run into is this:

error: the trait bound `ResourceFiles: HttpServiceFactory` is not satisfied
label: the trait `HttpServiceFactory` is not implemented for `ResourceFiles`

I assume this is change from earlier actix web versions.

The trait has been implemented, but I think it should be updated.

impl HttpServiceFactory for ResourceFiles {
    fn register(self, config: &mut AppService) {
        let rdef = if config.is_root() {
            ResourceDef::root_prefix(&self.path)
        } else {
            ResourceDef::prefix(&self.path)
        };
        config.register_service(rdef, None, self, None)
    }
}

Maybe I can help, but I'm kind of rust + actix newbie to be honest.

joepio commented 2 years ago

Right after posting I noticed the open PR, which probably will fix this. I think that the maintainer is waiting for a stable actix_web v4. Very understandable.

kilork commented 2 years ago

yes, you understand correctly. I actually was not expecting this beta would last so long, I see this as a bad sign to be honest. Probably we would have to create beta on our side as well, because it is difficult to just ignore demand from users, even psychologically. Stay tuned ;)

joepio commented 2 years ago

Seems like the Rob himself made a PR that is already accepted! Are you ready for a new release @kilork?

kilork commented 2 years ago

@joepio yes, started last weekend actually, but found an issue, should be released this weekend.

Seems like it is exactly this issue: https://github.com/kilork/actix-web-static-files/issues/49

Solution is ready, but it need to be tested.

joepio commented 2 years ago

Good to hear! Thanks for your efforts.

By the way, I'm currently using the latest master version, and it's working just fine. Probably because I don't host a folder on root.

kilork commented 2 years ago

v4.0.0 is released! Closing this PR, thank you for your patience!