Skip to content

Commit

Permalink
Merge pull request #22 from Anders429/tokens
Browse files Browse the repository at this point in the history
Remove need to use `Tokens` wrapper.
  • Loading branch information
Anders429 authored Dec 18, 2023
2 parents 31983ff + a3e2538 commit 93966f1
Show file tree
Hide file tree
Showing 7 changed files with 474 additions and 582 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog

## Unreleased
### Added
- `Tokens` now implements `IntoIterator<Item = Token>`.
- `&Tokens` now implements `IntoIterator<Item = &Token>`.
- The `token` module is now public, containing both `Token` (which is also exposed in the root module) and `Tokens`.
### Changed
- `de::Builder::tokens()` now accepts any type that implements `Clone + IntoIterator<Item = Token>`.
- `Tokens` is no longer exposed in the root module, instead being available at `token::Tokens`.
- The internals of `Tokens` are no longer public. `Tokens` can no longer be constructed by user code, and is now only returned by the `Serializer`.
- Comparison with a `Tokens` can now be done with any type that implements `IntoIterator<Item = &Token>`.

## 0.6.0 - 2023-11-19
### Changed
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ use serde::Serialize;
use serde_assert::{
Serializer,
Token,
Tokens,
};
let serializer = Serializer::builder().build();
assert_ok_eq!(true.serialize(&serializer), Tokens(vec![Token::Bool(true)]));
assert_ok_eq!(true.serialize(&serializer), [Token::Bool(true)]);
```

### Testing Deserialization
Expand All @@ -40,12 +39,9 @@ use serde::Deserialize;
use serde_assert::{
Deserializer,
Token,
Tokens,
};
let mut deserializer = Deserializer::builder()
.tokens(Tokens(vec![Token::Bool(true)]))
.build();
let mut deserializer = Deserializer::builder().tokens([Token::Bool(true)]).build();
assert_ok_eq!(bool::deserialize(&mut deserializer), true);
```
Expand Down
Loading

0 comments on commit 93966f1

Please sign in to comment.