Comments (4)
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.
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.
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.
That makes sense. Thanks for your input!
from chan.
Related Issues (19)
- remove hyper dev dependency HOT 4
- Possible memory leak in `tick` HOT 2
- [feature request] re-expose try_recv() HOT 8
- How to chan_select over multiple chans that will terminate? HOT 1
- Using chan_select! requires values to be 'static HOT 3
- Add timeout-able methods HOT 1
- doesn't seem to work with `fork()` HOT 2
- Allow chan_select to generate no-op None variants HOT 2
- Sender::send(t) -> Result<(), SendError> HOT 16
- Deadlock with select-send and select-recv HOT 2
- crossbeam-channel – EOL chan HOT 6
- Broadcast to all consumers HOT 4
- Return value from `chan_select!` expression HOT 2
- chan::async() conflicts with Rust 2018 Edition HOT 6
- I think it's butter to return a Result for invalid add HOT 5
- Relicense under dual MIT/Apache-2.0 HOT 8
- Async channel is blocking program HOT 9
- All Notifier subscriptions made in select.rs appear to be leaked HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chan.