Code Monkey home page Code Monkey logo

Comments (6)

djahandarie avatar djahandarie commented on May 29, 2024 1

For anyone trying to use async() on rust 2018, you can still use it via r#async(). (The compiler gives you this hint if you're trying to write chan::async() but not if it's imported at the top-level.)

Of course, this crate has been deprecated for https://github.com/crossbeam-rs/crossbeam-channel, so the long-term fix is likely moving over there.

from chan.

BurntSushi avatar BurntSushi commented on May 29, 2024

I don't think we need to rename anything? This crate should continue to work via Rust 2015.

from chan.

BurntSushi avatar BurntSushi commented on May 29, 2024

@troiganto Also, I expect to end-of-life chan in favor of https://github.com/crossbeam-rs/crossbeam-channel. The APIs are very similar, but the implementation quality is much higher and the select macro is much nicer.

from chan.

troiganto avatar troiganto commented on May 29, 2024

I see, sorry for the noise then. I mainly stumbled over chan because of chan-signal, which seems to be the most fleshed-out way to handle signals on Unix so far. But if we're talking about an end-of-life situation, it'll likely make sense to switch to another crate for that, as well.

In any case, thanks for the speedy and helpful response!

from chan.

BurntSushi avatar BurntSushi commented on May 29, 2024

@troiganto Yeah, I really need to just update the READMEs for this project. crossbeam-channel is definitely the path forward at this point. I do expect to end-of-life chan-signal as well. My hope is that someone builds a similar crate for handling signals using crossbeam-signal. See: BurntSushi/chan-signal#27

from chan.

BurntSushi avatar BurntSushi commented on May 29, 2024

@troiganto Doing a brief investigation, @vorner's signal-hook library looks very promising: https://crates.io/crates/signal-hook

You can basically re-create chan-signal with something like this, while swapping out whatever channel implementation you want:

fn signal_notify(signals: &[c_int]) -> Result<chan::Receiver<c_int>> {
    let (s, r) = chan::sync(100);
    let signals = signal_hook::iterator::Signals::new(signals)?;
    thread::spawn(move || {
        for signal in signals.forever() {
            s.send(signal);
        }
    });
    Ok(r)
}

from chan.

Related Issues (19)

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.