Skip to content

"Multi-type messaging" example does not compile #46

@igalic

Description

@igalic

the Multi-type Messaging example on the website does not compile.
Apart from missing use statements:

use std::time::Duration;
use riker::actors::*;

it still is wrong:

# cargo build
   Compiling website-examples v0.1.0 (/home/meena/src/riker-rs/website-examples)
error[E0277]: the trait bound `Counter: std::default::Default` is not satisfied
   --> src/main.rs:71:17
    |
71  |     let props = Props::new::<Counter>();
    |                 ^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `Counter`
    | 
   ::: /home/meena/.cargo/registry/src/github.com-1ecc6299db9ec823/riker-0.4.1/src/actor/props.rs:182:12
    |
182 |         A: ActorFactory,
    |            ------------ required by this bound in `riker::actor::props::Props::new`
    |
    = note: required because of the requirements on the impl of `riker::actor::props::ActorFactory` for `Counter`

error[E0308]: mismatched types
   --> src/main.rs:72:36
    |
72  |     let actor = sys.actor_of_props(props, "counter").unwrap();
    |                                    ^^^^^ expected `&str`, found struct `std::sync::Arc`
    | 
   ::: /home/meena/.cargo/registry/src/github.com-1ecc6299db9ec823/riker-0.4.1/src/actor/props.rs:180:34
    |
180 |     pub fn new<A>() -> Arc<Mutex<impl ActorProducer<Actor = A>>>
    |                                  ----------------------------- the found opaque type
    |
    = note: expected reference `&str`
                  found struct `std::sync::Arc<std::sync::Mutex<impl riker::actor::props::ActorProducer>>`

error[E0308]: mismatched types
  --> src/main.rs:72:43
   |
72 |     let actor = sys.actor_of_props(props, "counter").unwrap();
   |                                           ^^^^^^^^^ expected struct `std::sync::Arc`, found `&str`
   |
   = note: expected struct `std::sync::Arc<std::sync::Mutex<(dyn riker::actor::props::ActorProducer<Actor = _> + 'static)>>`
           found reference `&'static str`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `website-examples`.

To learn more, run the command again with --verbose.

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