Crates.io | serde_token |
lib.rs | serde_token |
version | 0.0.2 |
source | src |
created_at | 2019-06-24 06:09:55.145968 |
updated_at | 2019-06-24 06:20:53.35646 |
description | Utility for transcoding a Serde deserializer into a sink of tokens. |
homepage | |
repository | https://github.com/sunny-g/serde_token |
max_upload_size | |
id | 143133 |
size | 21,945 |
serde_token
provides a utility for transcoding a Serde deserializer into a sink of Token
s.
Install from Crates.io:
[dependencies]
serde_token = "0.0.2"
use futures::{unsync::mpsc::unbounded, Future, Sink, Stream};
use serde_json::Deserializer;
use serde_token::{tokenize, Token};
let mut de = Deserializer::from_str(r#" [ {"a":false}, "hello", 3 ] "#);
let (token_sink, token_stream) = unbounded::<Token>();
tokenize(&mut de, token_sink).unwrap();
let expected = token_stream.collect().wait().unwrap();
assert_eq!(expected, vec![
Token::Seq { len: None },
Token::Map { len: None },
Token::Str("a"),
Token::Bool(false),
Token::MapEnd,
Token::Str("hello"),
Token::U64(3),
Token::SeqEnd,
])
Sink
sending better (i.e. support back-pressure)Version | Change Summary |
---|---|
v0.0.2 | adds README |
v0.0.1 | initial release |
git checkout -b feature/fooBar
)git commit -am 'Add some fooBar'
)git push origin feature/fooBar
)MIT