Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actix example doesn't work (resolved) #64

Closed
rj-xy opened this issue May 15, 2019 · 1 comment
Closed

actix example doesn't work (resolved) #64

rj-xy opened this issue May 15, 2019 · 1 comment

Comments

@rj-xy
Copy link

rj-xy commented May 15, 2019

Hi,

I'm trying to get the actix example working in it's own new project.

But I get the following error:

no method named as_ref found for type mime_guess::Mime in the current scope
src/main.rs:22:61

$ cargo build 
Compiling embed_actix v0.1.0 (/home/rj/src/embed_actix)
error[E0599]: no method named `as_ref` found for type `mime_guess::Mime` in the current scope
--> src/main.rs:22:61
   |
22 |       HttpResponse::Ok().content_type(guess_mime_type(path).as_ref()).body(body)`
   |                                                             ^^^^^

cargo.toml:

[package]
name = "embed_actix"
version = "0.1.0"
authors = ["me <me@test.com>"]
edition = "2018"

[dependencies]
actix-web = "0.7.19"
rust-embed = "4.4.0"
mime_guess = "1.8.7"

src/main.rs is copy of (with no changes):
examples/actix.rs

Mime is defined as

#[derive(Clone, Debug, Eq, Hash, Ord, PartialOrd)]
pub struct Mime<T: AsRef<[Param]> = Vec<Param>>(pub TopLevel, pub SubLevel, pub T);

so should have the as_ref trait?

Any help to get this working would be great - thanks!

@rj-xy
Copy link
Author

rj-xy commented May 15, 2019

Found the problem - I was using a stable version of mime_guess, when I should have been using the latest alpha version. So my cargo.toml file looks like this (main.rs (copy of examples/actix.rs) is untouched):

[package]
name = "embed_actix"
version = "1.0.0"
authors = ["me <me@test.com>"]
edition = "2018"

[dependencies]
actix-web = "0.7"
mime_guess = "2.0.0-alpha.6"
rust-embed = "4.4.0"

@rj-xy rj-xy changed the title actix example doesn't work actix example doesn't work (resolved) May 16, 2019
@pyrossh pyrossh closed this as completed Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants