protocol icon indicating copy to clipboard operation
protocol copied to clipboard

Rust 2018

Open Byter09 opened this issue 7 years ago • 2 comments

Hello.

I wanted to write a small tool to calculate something distributed on a master with slaves and learn more about Rust on the way. Having a simple transport layer with the help of protocol seemed like a good way. I'm using rustc 1.31.0 (abe02cefd 2018-12-04) and am currently getting this error:

error[E0107]: wrong number of type arguments: expected 0, found 2                                                                                                                                                                       
 --> src/network.rs:4:10                                                                                                                                                                                                                
  |                                                                                                                                                                                                                                     
4 | #[derive(Protocol, Debug, PartialEq)]                                                                                                                                                                                               
  |          ^^^^^^^^ 2 unexpected type arguments                                                                                                                                                                                       

I'm trying to use this on:

#[derive(Protocol, Debug, PartialEq)]
pub enum Message {
    RequestRegistration,
    Register(Registration),
    Job(Job),
    Result(Job, Result),
    RequestStatus,
    Status(Status),
}

Sadly the error is not very helpful in explaining what exactly I'm doing wrong but I highly suggest it has to do with Rust 2018, because the examples still use extern crate and #[macro_use]. Also there's no edition = "2018" in the Cargo.toml.

Any help on this is very appreciated. I don't think there's any other crate that can do what procotol suggests it can do this easily.

Byter09 avatar Dec 13 '18 16:12 Byter09

Update: I just forked protocol, upgraded it manually to Rust 2018 and tried to use the git version in my little project. Turns out the error is still there and I still have no clue what it means. :confused:

Byter09 avatar Dec 15 '18 12:12 Byter09

Have you tried not using Result in there? It's signature is Result<T, E> (type, error).

pzmarzly avatar Apr 06 '19 16:04 pzmarzly