Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Split `Value` stream items into `Value` and `Null` Each implementation of `StreamReader` has an associated type called `Item` that represents the set of possible entities that the reader may encounter in its stream: | Reader | Item | |--------------|------------------| | RawReader | RawStreamItem | | SystemReader | SystemStreamItem | | Reader | StreamItem | While the entities enumerated by `Item` vary according to the reader's level of abstraction, all of them include a `Value` variant that indicates that the reader is currently positioned over an Ion value. Prior to this PR, each `Value` enum variant was modeled as: Value(IonType, bool) in which the `IonType` represented the value's corresponding Ion data type and the `bool` indicated whether the value was a `null`. This lead to user code that looked like: ```rust match reader.next()? { Value(IonType::String, true) => /* ... */, Value(IonType::String, false) => /* ... */, _ => {} } ``` In such situations, the meaning of the `true` or `false` was not obvious. This PR splits `Value(IonType, bool)` out into two variants for each enum: ```rust enum $NAME { // ... Value(IonType), Null(IonType), // ... } ```` This makes most interactions with the enum both more self-documenting and more concise. This PR also modifies `Reader` and `SymbolTable` to be able to handle non-`string` values in a local symbol table. Fixes #368.
- Loading branch information