Registry / networking / futures-codec

futures-codec

JSON →
library0.5.0rscratesunverified

Utilities for encoding and decoding frames using async/await, providing codec traits for asynchronous I/O.

# Cargo.toml [dependencies] futures_codec = "0.5.0"
INSTALL
IMPORT
SIG · FUTURES-CODEC
F
futures-codec
networkingrustv0.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Framed
use futures_codec::Framed;

Creates a framed stream using a length-prefixed codec over a TCP connection.

use futures_codec::{Framed, LengthCodec}; use tokio::net::TcpStream; async fn example() -> Result<(), Box<dyn std::error::Error>> { let stream = TcpStream::connect("127.0.0.1:8080").await?; let mut framed = Framed::new(stream, LengthCodec); // Use framed for reading/writing frames Ok(()) }
Debug
Known issues
gotchaRequires an async runtime like Tokio or async-std to execute.
fix
Add tokio as a dependency and use #[tokio::main] or similar runtime attribute.
affects: >=0.5.0
Upgrade
Version history
0.5.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
Amazon
1
Resources
futures-codec — cargo add futures-codec · libregistry