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

Axum 0.7.1 - no function or associated item named get found for struct Asset in the current scope #223

Closed
PXNX opened this issue Nov 30, 2023 · 1 comment

Comments

@PXNX
Copy link

PXNX commented Nov 30, 2023

Using Rust 1.74 and Axum 0.7.1 i get the following with the Axum example. Is there something I missed?

error[E0599]: no function or associated item named `get` found for struct `Asset` in the current scope                                                                             
  --> src\routes\mod.rs:63:22
   |
51 | struct Asset;
   | ------------ function or associated item `get` not found for this struct
...
63 |         match Asset::get(path.as_str()) {
   |                      ^^^ function or associated item not found in `Asset`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `get`, perhaps you need to implement one of them:
           candidate #1: `SliceIndex`
           candidate #2: `Row`
           candidate #3: `rustls::server::server_conn::StoresServerSessions`
           candidate #4: `RustEmbed`
@BBaoVanC
Copy link
Contributor

BBaoVanC commented Dec 1, 2023

Make sure that the directory you're using for static files is in the right place; it should be under the project directory, sibling to src/. Example from my program:

#[derive(RustEmbed)]
#[folder = "static/"]
struct Asset;
.
├── Cargo.toml
├── src
│   ├── lib.rs
│   ├── main.rs
│   └── static_routes.rs
└── static
    ├── css
    └── js

@pyrossh pyrossh closed this as completed Apr 19, 2024
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

3 participants