Git Product home page Git Product logo

Comments (6)

Blayung avatar Blayung commented on August 16, 2024 1

Okay! It fixed the issue, it was just my inattention. Sorry for bothering you.

from message-io.

lemunozm avatar lemunozm commented on August 16, 2024

Hi, how are you compiling them? a simple cargo test for me compile the example without errors

from message-io.

lemunozm avatar lemunozm commented on August 16, 2024

What is your rust version?

from message-io.

Blayung avatar Blayung commented on August 16, 2024

My rustc version: rustc 1.74.1 (a28077b28 2023-12-04)

And I'm not compiling your examples, I'm compiling my modified code - your examples indeed work as expected. I don't know what's wrong with mine though.

I'm doing this:

let (network_handler, network_listener) = message_io::node::split();
let (server, _) = network_handler.network().connect(message_io::network::Transport::FramedTcp, SERVER_ADDRESS).unwrap();

let mut network_thread = network_listener.for_each_async(move |node_event| match node_event {
    message_io::node::NodeEvent::Network(net_event) => match net_event {
        message_io::network::NetEvent::Connected(_, is_ok) => {
            assert!(is_ok);

        },
        message_io::network::NetEvent::Message(_, data) => {

        },
        message_io::network::NetEvent::Disconnected(_) => {},
        message_io::network::NetEvent::Accepted(_, _) => unreachable!()
    },
    message_io::node::NodeEvent::Signal(_) => {}
});

from message-io.

Blayung avatar Blayung commented on August 16, 2024

I've updated rust and now it returns a diffrent, but very similar error:

error[E0283]: type annotations needed for `NodeEvent<'_, S>`
   --> src/client.rs:29:72
    |
26  | ...work_listener) = message_io::node::split();
    |                     ------------------------- type must be known at this point
...
29  | ...network_listener.for_each_async(move |node_event| match node_event {
    |                                          ^^^^^^^^^^
    |
    = note: cannot satisfy `_: Send`
note: required by a bound in `message_io::node::split`
   --> /home/wojtek/.cargo/registry/src/index.crates.io-6f17d22bba15001f/message-io-0.18.1/src/node.rs:180:17
    |
180 | pub fn split<S: Send>() -> (NodeHandler<S>, NodeListener<S>) {
    |                 ^^^^ required by this bound in `split`
help: consider giving this closure parameter an explicit type, where the type for type parameter `S` is specified
    |
29  |         let mut network_thread = network_listener.for_each_async(move |node_event: NodeEvent<'_, S>| match node_event {
    |                                                                                  ++++++++++++++++++

from message-io.

lemunozm avatar lemunozm commented on August 16, 2024

You need to specify the signal type. You can see this in the examples, i.e, in the README example it's as follows (for an empty signal () type):

let (handler, listener) = node::split::<()>();

Please note that I can give support to the library itself. But I do not for external code.

from message-io.

Related Issues (20)

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.