Restioson / spaad

⚛️ Zero-boilerplate actor systems with xtra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confusing versioning scheme

wbrickner opened this issue · comments

Code

Cargo.toml:

[dependencies]
spaad = "0.3.2"
xtra = "0.5.1"
tokio = { version = "1.12.0", features = ["full"] }

src/main.rs:

use xtra::prelude::*;

#[spaad::entangled]
pub struct Printer {
    times: usize,
}

#[spaad::entangled]
impl Actor for Printer {}

#[spaad::entangled]
impl Printer {
    #[spaad::spawn]
    pub fn new() -> Self {
        Printer { times: 0 }
    }

    #[spaad::handler]
    pub fn print(&mut self, to_print: String) {
        self.times += 1;
        println!(
            "Printing {}. Printed {} times so far.",
            to_print, self.times
        );
    }
}

#[tokio::main]
async fn main() {
    let printer = Printer::new();

    loop {
        printer.print("hello".to_string()).await;
    }
}

Output

error[E0277]: the trait bound `__PrinterActor::Printer: spaad::export::xtra::Actor` is not satisfied
   --> src/main.rs:3:1
    |
3   | #[spaad::entangled]
    | ^^^^^^^^^^^^^^^^^^^ the trait `spaad::export::xtra::Actor` is not implemented for `__PrinterActor::Printer`
    |
note: required by a bound in `spaad::export::xtra::Address`
   --> /Users/wbrickner/.cargo/registry/src/github.com-1ecc6299db9ec823/xtra-0.4.2/src/address.rs:166:23
    |
166 | pub struct Address<A: Actor> {
    |                       ^^^^^ required by this bound in `spaad::export::xtra::Address`
    = note: this error originates in the attribute macro `spaad::entangled` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `__PrinterActor::Printer: spaad::export::xtra::Actor` is not satisfied
  --> src/main.rs:11:1
   |
11 | #[spaad::entangled]
   | ^^^^^^^^^^^^^^^^^^^ the trait `spaad::export::xtra::Actor` is not implemented for `__PrinterActor::Printer`
   |
note: required by a bound in `SyncHandler`
  --> /Users/wbrickner/.cargo/registry/src/github.com-1ecc6299db9ec823/xtra-0.4.2/src/lib.rs:92:36
   |
92 | pub trait SyncHandler<M: Message>: Actor {
   |                                    ^^^^^ required by this bound in `SyncHandler`
   = note: this error originates in the attribute macro `spaad::entangled` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `__PrinterActor::Printer: spaad::export::xtra::Actor` is not satisfied
  --> src/main.rs:11:1
   |
11 | #[spaad::entangled]
   | ^^^^^^^^^^^^^^^^^^^ the trait `spaad::export::xtra::Actor` is not implemented for `__PrinterActor::Printer`
   |
note: required by a bound in `spaad::export::xtra::Context`
  --> /Users/wbrickner/.cargo/registry/src/github.com-1ecc6299db9ec823/xtra-0.4.2/src/context.rs:19:23
   |
19 | pub struct Context<A: Actor> {
   |                       ^^^^^ required by this bound in `spaad::export::xtra::Context`
   = note: this error originates in the attribute macro `spaad::entangled` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `actix_trial` due to 3 previous errors

Spaad 0.3 is associated with xtra 0.4 whiuch is why this fails to compile. Spaad beta 0.4.0 is associated with xtra beta 0.5.0. I'll cut a release today for spaad 0.4.0 and xtra 0.5.0, thanks for the reminder

Thanks so much, amazing work!

If there are strict compatibility relationships, do you think each version of spaad would do well to depend on a the latest version of xtra itself?

What is gained by making the user depend on each separately (and therefore expecting them to know the compatibilities)?

I've released spaad 0.4.0 for xtra 0.5.0.

do you think each version of spaad would do well to depend on a the latest version of xtra itself?

This was the case until I got a bit behind on maintaining spaad. It is currently restored again.

It might make more sense for spaad version to be even with xtra version. When xtra 0.6.0 is released I'll do this probably.

EDIT: hijacked this a bit to track the confusing versioning.