sagebind / sluice Goto Github PK
View Code? Open in Web Editor NEWAsynchronous byte buffers and pipes for concurrent I/O programming.
Home Page: https://docs.rs/sluice
License: MIT License
Asynchronous byte buffers and pipes for concurrent I/O programming.
Home Page: https://docs.rs/sluice
License: MIT License
PipeReader
is already internally buffered, so it should implement AsyncBufRead
to avoid double-buffering.
Pipes are also useful in synchronous applications, which could also benefit from our performant rotating buffer implementation.
There's no technical reason why the existing PipeReader
and PipeWriter
types couldn't implement Read
and Write
respectively, but I wonder if that might get confusing which trait is being used, since Read::read
and AsyncReadExt::read
have the same name and argument types.
The API we offer must also allow the possibility of having an async producer and synchronous consumer, or vice versa.
futures-channel
is known to be of poor performance; would using async-channel
or flume
be considered?
Example usage demonstrating incorrect behavior: https://gist.github.com/egonelbre/eadeed2ff4a07226670b484e9a2a2b5b
Compiling sluice v0.5.1 (/home/brain/rpmbuild/BUILD/sluice-0.5.1)
Running `/usr/bin/rustc --edition=2018 --crate-name sluice src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=03b9863647ea8ece -C extra-filename=-03b9863647ea8ece --out-dir /home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps -L dependency=/home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps --extern futures_channel=/home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps/libfutures_channel-2d4bc6c413b60832.rmeta --extern futures_core=/home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps/libfutures_core-cbe64fd3f840fa1d.rmeta --extern futures_io=/home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps/libfutures_io-6ef128f8917047b3.rmeta --extern futures_util=/home/brain/rpmbuild/BUILD/sluice-0.5.1/target/release/deps/libfutures_util-0c17dd2ad5e16723.rmeta -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now -Ccodegen-units=1 --cap-lints=warn`
error[E0432]: unresolved import `futures_util::io`
--> src/pipe/chunked.rs:26:19
|
26 | use futures_util::io::Cursor;
| ^^ could not find `io` in `futures_util`
error[E0599]: no method named `poll_next` found for type `std::pin::Pin<_>` in the current scope
--> src/pipe/chunked.rs:92:57
|
92 | match Pin::new(&mut self.buf_stream_rx).poll_next(cx) {
| ^^^^^^^^^ method not found in `std::pin::Pin<_>`
|
= note: Pin::new(&mut self.buf_stream_rx) is a function, perhaps you wish to call it
error[E0599]: no method named `poll_read` found for type `std::pin::Pin<&mut _>` in the current scope
--> src/pipe/chunked.rs:106:46
|
106 | let len = match Pin::new(&mut chunk).poll_read(cx, buf) {
| ^^^^^^^^^ method not found in `std::pin::Pin<&mut _>`
|
= note: Pin::new(&mut chunk) is a function, perhaps you wish to call it
error[E0599]: no method named `poll_next` found for type `std::pin::Pin<_>` in the current scope
--> src/pipe/chunked.rs:170:47
|
170 | match Pin::new(&mut self.buf_pool_rx).poll_next(cx) {
| ^^^^^^^^^ method not found in `std::pin::Pin<_>`
|
= note: Pin::new(&mut self.buf_pool_rx) is a function, perhaps you wish to call it
warning: unused import: `FusedStream`
--> src/pipe/chunked.rs:24:20
|
24 | use futures_core::{FusedStream, Stream};
| ^^^^^^^^^^^
|
note: lint level defined here
--> src/lib.rs:18:5
|
18 | unused,
| ^^^^^^
= note: `#[warn(unused_imports)]` implied by `#[warn(unused)]`
warning: unused import: `Stream`
--> src/pipe/chunked.rs:24:33
|
24 | use futures_core::{FusedStream, Stream};
| ^^^^^^
error: aborting due to 4 previous errors
Hi,
I want to use PiperWriter to write to sluice channel in chunks, I receive a chunk of byte array in fixed intervals in a callback function which I want to write to PipeWriter so the reader on the other end can read it.
The documentation is not clear on the usage examples. Please let me know how to write using PipeWriter?
Dependabot couldn't resolve your project's dependencies as it couldn't access [crates.io-index](https://github.com/rust-lang/crates.io-index
).
You can provide additional git credentials in your Dependabot dashboard by clicking into the account menu (in the top right) and selecting 'Config variables'. If you use a custom token for the host github.com
make sure it has read access to this repo, too.
See the stack trace here: sagebind/isahc#72
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.