Skip to content

Doesnt compile problems with serveDIR/servodeExt #51

@NicTanghe

Description

@NicTanghe

Ok so all the way back the first time i ran it worked and if i wanted to use this i just copied that one over becouse:

the default one doesn't compile:

these 2 are trowing errors.

use crate::app::App;
use tower::ServiceExt;

IDE:
1 : trait service servriceEXT which provides one-shot is implemented but not in scope

testimg on  main [?] is  v0.1.0 via  v1.82.0-nightly  cargo leptos build --release
    Finished `wasm-release` profile [optimized] target(s) in 0.16s
       Cargo finished cargo build --package=testimg --lib --target-dir=/home/fucker/dev/leptos/testimg/target/front --target=wasm32-unknown-unknown --no-default-features --features=
hydrate --profile=wasm-release
       Front compiling WASM
[swc_ecma_transforms_optimization] tree-shaker; pass=0
   Compiling testimg v0.1.0 (/home/fucker/dev/leptos/testimg)
error[E0432]: unresolved import `tower::ServiceExt`
   --> src/fileserv.rs:10:5
    |
10  | use tower::ServiceExt;
    |     ^^^^^^^^^^^^^^^^^ no `ServiceExt` in the root
    |
note: found an item that was configured out
   --> /home/fucker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:223:34
    |
223 | pub use self::util::{service_fn, ServiceExt};
    |                                  ^^^^^^^^^^
note: the item is gated behind the `util` feature
   --> /home/fucker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:220:7
    |
220 | #[cfg(feature = "util")]
    |       ^^^^^^^^^^^^^^^^
help: a similar name exists in the module
    |
10  | use tower::Service;
    |            ~~~~~~~
help: consider importing this trait instead
    |
10  | use axum::ServiceExt;
    |     ~~~~~~~~~~~~~~~~

error[E0599]: no method named `oneshot` found for struct `ServeDir` in the current scope
  --> src/fileserv.rs:51:10
   |
48 |       match ServeDir::new(root)
   |  ___________-
49 | |         .precompressed_gzip()
50 | |         .precompressed_br()
51 | |         .oneshot(request)
   | |_________-^^^^^^^
   |
  ::: /home/fucker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.5.1/src/util/mod.rs:85:8
   |
85 |       fn oneshot(self, req: Request) -> Oneshot<Self, Request>
   |          ------- the method is available for `ServeDir` here
   |
   = help: items from traits can only be used if the trait is in scope
help: there is a method `ready_oneshot` with a similar name, but with different arguments
  --> /home/fucker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.5.1/src/util/mod.rs:77:5
   |
77 | /     fn ready_oneshot(self) -> ReadyOneshot<Self, Request>
78 | |     where
79 | |         Self: Sized,
   | |____________________^
help: trait `ServiceExt` which provides `oneshot` is implemented but not in scope; perhaps you want to import it
   |
1  + use tower::util::ServiceExt;
   |

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