Deboa Extras
This crate provides additional features for Deboa like compression and serialization.
Install
cargo add deboa-extras
Features
- compression (gzip, deflate and brotli)
- serialization (json, xml, msgpack)
- sse
- websockets
Usage
Decompression
use ;
use ;
let encoding_catcher = register_decoders;
let client = builder
.catch
.build?
let posts = get?
.go
.await?
.body_as?;
println!;
Serialization
use ;
use JsonBody;
let client = new;
let data = Post ;
let response = post?
.body_as?
.go
.await?;
println!;
SSE
use ;
use ;
let mut client = new;
let response = client.execute.await?.into_event_stream;
// Poll events, until the connection is closed
// please note that this is a blocking call
while let Some = response.next.await
println!;
Websockets
use ;
use ;
let mut client = new;
let websocket = websocket?
.go
.await?
.into_websocket
.await;
while let Ok = websocket.read_message.await
License
MIT
Author
Rogerio Pereira Araujo rogerio.araujo@gmail.com