#client #networking #server #stream #channel

channels

Bidirectional channel-like communication over generic Read/Write streams

19 releases (9 breaking)

0.10.0 Aug 30, 2023
0.8.0 Jun 18, 2023
0.6.7 Feb 23, 2023
0.6.1 Dec 24, 2022
0.1.1 Jul 23, 2022

#1148 in Network programming

Download history 22/week @ 2023-06-07 21/week @ 2023-06-14 41/week @ 2023-06-21 21/week @ 2023-06-28 14/week @ 2023-07-05 7/week @ 2023-07-12 6/week @ 2023-07-19 11/week @ 2023-07-26 40/week @ 2023-08-02 43/week @ 2023-08-09 40/week @ 2023-08-16 23/week @ 2023-08-23 337/week @ 2023-08-30 29/week @ 2023-09-06 1/week @ 2023-09-13 11/week @ 2023-09-20

399 downloads per month

MIT license

92KB
2.5K SLoC

channels-rs

A crate that allows for easy and fast communication between processes, threads and systems.

license-badge version-badge downloads-badge

tests-badge docs-badge

Repos

This library is available in the following languages:

  • Rust
  • C (work in progress)

Sender/Receiver types to be used with any type that implements std::io::Read and std::io::Write.

This crate is similar to std::sync::mpsc in terms of the API, and most of the documentation for that module carries over to this crate.

Don't think of these channels as a replacement for std::sync::mpsc, but as another implementation that works over many different transports.

These channels are meant to be used in combination with network sockets, local sockets, pipes, etc.

The differences are:

  • Channels will block, unless the underlying stream is set as non-blocking.
  • The amount of messages that can be queued up before reading is dependent on the underlying stream.

Features

  • 🚀 Async & Sync API
  • 📥 Transparent compression
  • 🔑 Transparent authentication with HMAC-SHA3-512
  • ➕ Transparent checksumming with CRC

cargo features

  • cbor: Adds support for sending/receiving any type with ciborium.
  • crc: Adds support for verifying data with CRC checksums.
  • flate2: Adds support for compressing data with flate2.
  • hmac: Adds support for cryptographically signing data with hmac and sha3.
  • json: Adds support for sending/receiving any type with serde_json.
  • statistics: Capture statistic data like: total bytes sent/received, timestamp of last packet, etc
  • tokio: Adds support for sending/receiving types asynchronously.

cargo default features

Examples

See: examples/

Dependencies

~0.3–2.4MB
~42K SLoC