Crate async_proto
source · [−]Expand description
This is async-proto, a library crate facilitating simple binary network protocols with async support.
The main feature is the Protocol trait, which allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.
Protocol can be derived for enums and structs if all fields implement Protocol.
Features
This crate offers optional dependencies on the following crates to enable Protocol implementations for some of their types:
bytes:Byteschrono:NaiveDate,DateTime,Utc, andFixedOffsetchrono-tz:Tznoisy_float:NoisyFloatsemver:Version,Prerelease, andBuildMetadataserde_json:Value,Map, andNumber
Additionally, the following features can be enabled via Cargo:
tokio-tungstenite: Adds a dependency on thetokio-tungstenitecrate and convenience methods for reading/writingProtocoltypes from/to its websockets.warp: Adds a dependency on thewarpcrate and convenience methods for reading/writingProtocoltypes from/to its websockets.
Macros
Implements Protocol for a type defined using the bitflags::bitflags macro.
Enums
The error returned from the write and write_sync methods.
Traits
This trait allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.
Derive Macros
Implements the Protocol trait for this type.