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 enum
s and struct
s 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
:Bytes
chrono
:NaiveDate
,DateTime
,Utc
, andFixedOffset
chrono-tz
:Tz
noisy_float
:NoisyFloat
serde_json
:Value
,Map
, andNumber
Additionally, the following features can be enabled via Cargo:
tokio-tungstenite
: Adds a dependency on thetokio-tungstenite
crate and convenience methods for reading/writing [Protocol
] types from/to its websockets.warp
: Adds a dependency on thewarp
crate and convenience methods for reading/writing [Protocol
] types from/to its websockets.