Byte Stream Codec (src/lib.rs)

ntex · ntex-codec/src/lib.rs · rust · Apache-2.0
infra, realtime, lang:rust, tag:codec, tag:performance

Provides traits for encoding and decoding byte streams into structured frames. Use this when building custom network protocols or high-performance communication services.

// Source: https://github.com/ntex-rs/ntex | License: Apache-2.0 | Copyright 2021-NOW ntex contributors <team@ntex.rs>
// Provided via justclaw.it.com; keep this notice with the code.
//! Traits for encoding and decoding frames.
//!
//! A codec turns a byte stream into frames and back. [`Decoder`] splits
//! incoming bytes into frames, [`Encoder`] serializes outgoing frames. The
//! `ntex-io` crate drives them: `Io::recv()` and `IoRef::decode()` run the
//! decoder on the read buffer, `Io::send()` and `IoRef::encode()` run the
//! encoder on the write buffer, and the `ntex-dispatcher` crate uses both to
//! connect a stream to a service.
//!
//! Both traits take `&self`, since a codec is shared between the reading and
//! writing sides. A codec that keeps state between calls, such as a par

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key