framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.18k stars 89 forks source link

error about tiny example #152

Closed jeromeleong closed 2 years ago

jeromeleong commented 2 years ago

I use perseus serve in https://github.com/arctic-hen7/perseus/tree/main/examples/comprehensive/tiny and can't output the web app

  --> src/lib.rs:60:22
   |
60 |         error_pages: app.get_error_pages(),
   |                      ^^^^^^^^^^^^^^^^^^^^^ expected struct `ErrorPages`, found struct `perseus::error_pages::ErrorPages`
   |
   = note: expected struct `ErrorPages<DomNode>`
              found struct `perseus::error_pages::ErrorPages<_>`
   = note: perhaps two different versions of crate `perseus` are being used?

error[E0277]: the trait bound `G: sycamore_web::Html` is not satisfied
  --> src/lib.rs:51:30
   |
51 |         templates => &main::<G>().get_templates_map(),
   |                              ^ the trait `sycamore_web::Html` is not implemented for `G`
   |
note: required by a bound in `__perseus_main`
  --> /Users/jerome/Desktop/rust_project/perseus/examples/comprehensive/tiny/src/lib.rs:4:1
   |
4  | #[perseus::main]
   | ^^^^^^^^^^^^^^^^ required by this bound in `__perseus_main`
   = note: this error originates in the attribute macro `perseus::main` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `G`
   |
25 |         impl<G: sycamore_web::Html: $crate::Html> ::sycamore_router::Route for $name<G> {
   |               ++++++++++++++++++++

error[E0599]: the method `get_templates_map` exists for struct `perseus::init::PerseusAppBase<G, perseus::stores::mutable::FsMutableStore, perseus::i18n::translations_manager::FsTranslationsManager>`, but its trait bounds were not satisfied
  --> src/lib.rs:51:35
   |
51 |         templates => &main::<G>().get_templates_map(),
   |                                   ^^^^^^^^^^^^^^^^^ method cannot be called on `perseus::init::PerseusAppBase<G, perseus::stores::mutable::FsMutableStore, perseus::i18n::translations_manager::FsTranslationsManager>` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `G: sycamore_web::Html`

error[E0277]: the trait bound `G: sycamore_web::Html` is not satisfied
  --> src/lib.rs:51:23
   |
51 |         templates => &main::<G>().get_templates_map(),
   |                       ^^^^^^^^^^^ the trait `sycamore_web::Html` is not implemented for `G`
   |
note: required by a bound in `perseus::init::PerseusAppBase`
  --> /Users/jerome/Desktop/rust_project/perseus/packages/perseus/src/init.rs:85:30
   |
85 | pub struct PerseusAppBase<G: Html, M: MutableStore, T: TranslationsManager> {
   |                              ^^^^ required by this bound in `perseus::init::PerseusAppBase`
help: consider restricting type parameter `G`
   |
25 |         impl<G: sycamore_web::Html: $crate::Html> ::sycamore_router::Route for $name<G> {
   |               ++++++++++++++++++++

error[E0277]: the trait bound `G: sycamore_web::Html` is not satisfied
  --> src/lib.rs:52:28
   |
52 |         locales => &main::<G>().get_locales()
   |                            ^ the trait `sycamore_web::Html` is not implemented for `G`
   |
note: required by a bound in `__perseus_main`
  --> /Users/jerome/Desktop/rust_project/perseus/examples/comprehensive/tiny/src/lib.rs:4:1
   |
4  | #[perseus::main]
   | ^^^^^^^^^^^^^^^^ required by this bound in `__perseus_main`
   = note: this error originates in the attribute macro `perseus::main` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `G`
   |
25 |         impl<G: sycamore_web::Html: $crate::Html> ::sycamore_router::Route for $name<G> {
   |               ++++++++++++++++++++

error[E0599]: the method `get_locales` exists for struct `perseus::init::PerseusAppBase<G, perseus::stores::mutable::FsMutableStore, perseus::i18n::translations_manager::FsTranslationsManager>`, but its trait bounds were not satisfied
  --> src/lib.rs:52:33
   |
52 |         locales => &main::<G>().get_locales()
   |                                 ^^^^^^^^^^^ method cannot be called on `perseus::init::PerseusAppBase<G, perseus::stores::mutable::FsMutableStore, perseus::i18n::translations_manager::FsTranslationsManager>` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `G: sycamore_web::Html`

error[E0277]: the trait bound `G: sycamore_web::Html` is not satisfied
  --> src/lib.rs:52:21
   |
52 |         locales => &main::<G>().get_locales()
   |                     ^^^^^^^^^^^ the trait `sycamore_web::Html` is not implemented for `G`
   |
note: required by a bound in `perseus::init::PerseusAppBase`
  --> /Users/jerome/Desktop/rust_project/perseus/packages/perseus/src/init.rs:85:30
   |
85 | pub struct PerseusAppBase<G: Html, M: MutableStore, T: TranslationsManager> {
   |                              ^^^^ required by this bound in `perseus::init::PerseusAppBase`
help: consider restricting type parameter `G`
   |
25 |         impl<G: sycamore_web::Html: $crate::Html> ::sycamore_router::Route for $name<G> {
   |               ++++++++++++++++++++

warning: unused import: `plugins::PluginAction`
  --> src/lib.rs:12:5
   |
12 |     plugins::PluginAction,
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

Some errors have detailed explanations: E0277, E0308, E0599.
For more information about an error, try `rustc --explain E0277`.
warning: `perseus-engine` (lib) generated 1 warning
error: could not compile `perseus-engine` due to 9 previous errors; 1 warning emitted
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: "cargo" "build" "--lib" "--target" "wasm32-unknown-unknown"
github-actions[bot] commented 2 years ago

This repo is set up to triage issues with Tribble, but this issue couldn't be processed. If you deliberately didn't use Tribble to report this issue, you can safely ignore this warning. If you did, something's gone wrong here.

arctic-hen7 commented 2 years ago

Have you cloned the repo itself? If so, you'll need to use bonnie dev example comprehensive tiny serve instead. The repo uses a bleeding edge version of the perseus CLI that's ahead of the published version.

Otherwise, you can copy the code from just the tiny example and put that into a new folder (updating the dependencies to not point to the local versions of perseus) and perseus serve should work!

arctic-hen7 commented 2 years ago

@jeromeleong did my suggestions above work? If so, I can close this issue.

arctic-hen7 commented 2 years ago

This hasn't been active for a while, so I'm going to close it. If you're still having this problem, please let me know.