GithubHelp home page GithubHelp logo

sagebind / sluice Goto Github PK

View Code? Open in Web Editor NEW
97.0 4.0 8.0 74 KB

Asynchronous byte buffers and pipes for concurrent I/O programming.

Home Page: https://docs.rs/sluice

License: MIT License

Rust 100.00%
rust asynchronous buffers

sluice's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sluice's Issues

Add synchronous pipe API

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.

Use async-channel or flume

futures-channel is known to be of poor performance; would using async-channel or flume be considered?

Can't compile sluice on Fedora Rawhide

   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

Use PipeWriter to write asynchronously

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 needs permission to see crates.io-index`

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.

View the update logs.

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.