Code Monkey home page Code Monkey logo

Comments (4)

BurntSushi avatar BurntSushi commented on May 31, 2024

Thanks for the kind words!

I don't see how your request is possible. Could you perhaps suggest a straw man implementation path?

It might help if you stated the specific problem you are trying to solve.

from chan.

softprops avatar softprops commented on May 31, 2024

Sure. I'm working on integrating the notify crate into my bazel build workflow https://github.com/meetup/rebazel/blob/master/src/main.rs#L131.

The notify crate requires an mpsc sender.

Ideally I could have two watchers one for each kind of file I'm watching: build definitions which define sources and one for the source files them selves. Atm my program only has one watcher for both but then I have to try to infer by file name what kind of file changed when any file changed

https://github.com/meetup/rebazel/blob/master/src/main.rs#L140

That feels fragile. This sounded like a perfect case for chans select macro where I may have two watchers and and two recievers but i cant use it with the buillt in mpsc recievers with Chan's select.

I was wondering if there were any suggestions for patterns on adapting those to chan interfaces or visa versa

from chan.

BurntSushi avatar BurntSushi commented on May 31, 2024

The "select" functionality in this crate is deeply coupled to the channels themselves. Is it possible to design a higher level interface and try to unify all possible channel implementation? I'm honestly not sure. I wrote this code a long time ago and I don't have a good feel for the essential challenges in that task. Moreover, it feels like a very hard task, and one that I have no plans of working on. :-)

With all that said, I feel like the obvious answer to this problem might be going unnoticed. If you have a mpsc::Sender but you want all of your code to work with chan channels, then it should be straight-forward to create a chan channel for the mpsc::Sender, and then spawn a thread that reads from the chan channel and forwards messages to the mpsc::Sender channel. Rinse and repeat for each integration point.

from chan.

softprops avatar softprops commented on May 31, 2024

That makes sense. Thanks for your input!

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.