Giter Club home page Giter Club logo

waiter's People

Contributors

dmitryb-dev avatar khooj avatar ltouati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

waiter's Issues

cargo build: waiter_codegen v1.6.4: could not find `export` in `syn`

I get this error when building my project, where I try to add waiter_ci in Cargo.toml:

   Compiling waiter_codegen v1.6.4
error[E0432]: unresolved import `syn::export`
 --> /home/yves/.cargo/registry/src/github.com-1ecc6299db9ec823/waiter_codegen-1.6.4/src/lib.rs:7:10
  |
7 | use syn::export::{TokenStream2, ToTokens};
  |          ^^^^^^ could not find `export` in `syn`

[× many times…]

error: cannot determine resolution for the macro `quote::quote`
  --> /home/yves/.cargo/registry/src/github.com-1ecc6299db9ec823/waiter_codegen-1.6.4/src/component/mod.rs:80:18
   |
80 |     let result = quote::quote! {
   |                  ^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

[× many times…]

Support traits defined in crate

I extended the 3_inject_options_list.rs example to implement Interface4 from crate test_def.

use test_def::Interface4;

#[provides]
impl Interface4 for Comp {
    fn int4(&self) {
        println!("Interface 4");
    }
}

I get the following compiling error:

cargo run --color=always --package waiter_di --example 3_inject_options_list
   Compiling waiter_di v1.6.4 (/home/steve/workspaces/playground/rust/waiter)
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> examples/3_inject_options_list.rs:116:1
    |
116 | #[provides]
    | ^^^^^^^^^^^
    | |
    | impl doesn't use only types from inside the current crate
    | `waiter_di::Container` is not defined in the current crate
    | `dyn Interface4` is not defined in the current crate
    |
    = note: define and implement a trait or new type instead
    = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0117`.
error: could not compile `waiter_di`

Support async factory functions

I'm testing the following async factory function:

struct Dependency {
    msg: &'static str
}

impl Dependency {
    async fn dep(&self) {
        println!("Dep {}", self.msg);
    }
}

#[provides]
async fn create_dependency() -> Dependency {
    async {
        println!("dep factory");
    }.await;
    Dependency { msg: "Hello, World!" }
}

#[async_std::main]
async fn main() {
    let mut container = Container::<profiles::Default>::new();

    let comp = Provider::<Dependency>::get_ref(&mut container);
    comp.dep().await;
}

I get the following compiling error:

cargo run --color=always --package async_example --bin async_example
   Compiling async_example v0.0.1 (/home/steve/workspaces/forks/waiter/crates/async_example)
error[E0308]: mismatched types
  --> crates/async_example/src/main.rs:30:1
   |
30 | #[provides]
   | ^^^^^^^^^^^
   | |
   | expected struct `Dependency`, found opaque type
   | expected `Dependency` because of return type
31 | async fn create_dependency() -> Dependency {
   |                                 ---------- the `Output` of this `async fn`'s found opaque type
   |
   = note:   expected struct `Dependency`
           found opaque type `impl Future`
   = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: could not compile `async_example`

`#[component]` cannot handle empty struct types

this works:

#[component]
struct SpecificDuck {}

this does not work:

#[component]
struct SpecificDuck;

the error is:

error[E0618]: expected function, found struct `SpecificDuck`
  --> examples/01-waiter-di.rs:11:8
   |
10 | #[component]
   | ------------ call expression requires function
11 | struct SpecificDuck;
   | -------^^^^^^^^^^^^
   | |
   | struct `SpecificDuck` defined here
   |
help: `SpecificDuck` is a unit struct, and does not take parentheses to be constructed
   |
10 - #[component]
10 + #[component]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.