AWS Event Stream Parser
Rust implementation of the vnd.amazon.event-stream
-binary format
Implementation is based on following:
- https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html#RESTObjectSELECTContent-responses
- https://github.com/awslabs/aws-c-event-stream
- https://github.com/aws/aws-sdk-ruby/
- https://github.com/lifion/lifion-aws-event-stream
Installation
Add this to your Cargo.toml:
[]
= "0.0.5"
Usage
Plain parser
extern crate aws_event_stream_parser;
use parse_message;
let res = parse_message.unwrap;
println!;
/*
([], Message {
prelude: PreludeBlock {
total_length: 61,
- headers_length: 32,
checksum: 134054806
},
headers: HeaderBlock {
headers: [
Header { key: "content-type", value: String("application/json") }
]
},
body: [123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125],
checksum: 2375813297 })
*/
println!;
// true
Framed codec
(more information from https://tokio.rs/docs/going-deeper/frames/ )
use EventStreamCodec;
connect.and_then;
Specification
This parser has been modeled based on AWS documentation and other protocol implementations. We have also documented the format for future implementations.
Header diagrams
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.