rename FlattenIValues Iterator to FlattenIRecordIterator

This commit is contained in:
vms 2020-12-29 12:41:02 +03:00
parent ffbe1a282a
commit 9afa1e2e15
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
//! Provides a deserializer from WIT values to Rust value.
use crate::{values::FlattenIValueIterator, IType, IValue};
use crate::{values::FlattenIRecordIterator, IType, IValue};
use serde::{de, Deserialize};
use std::{
fmt::{self, Display},
@ -65,13 +65,13 @@ where
/// The deserializer. The iterator iterates over `IValue`s,
/// all flatten, see `FlattenIValueIterator`.
struct Deserializer<'de> {
iterator: Peekable<FlattenIValueIterator<'de>>,
iterator: Peekable<FlattenIRecordIterator<'de>>,
}
impl<'de> Deserializer<'de> {
pub fn new(input: &'de [IValue]) -> Deserializer<'de> {
Deserializer {
iterator: FlattenIValueIterator::new(input).peekable(),
iterator: FlattenIRecordIterator::new(input).peekable(),
}
}
}

View File

@ -8,11 +8,11 @@ pub use crate::serde::{de::from_interface_values, ser::to_interface_value};
/// Iterates over a vector of `IValues` but flatten all the
/// values. So `I32(1), Record([I32(2), I32(3)]), I32(4)` will be
/// iterated like `I32(1), I32(2), I32(3), I32(4)`.
pub(crate) struct FlattenIValueIterator<'a> {
pub(crate) struct FlattenIRecordIterator<'a> {
iterators: Vec<Iter<'a, IValue>>,
}
impl<'a> FlattenIValueIterator<'a> {
impl<'a> FlattenIRecordIterator<'a> {
pub(crate) fn new(values: &'a [IValue]) -> Self {
Self {
iterators: vec![values.iter()],
@ -20,7 +20,7 @@ impl<'a> FlattenIValueIterator<'a> {
}
}
impl<'a> Iterator for FlattenIValueIterator<'a> {
impl<'a> Iterator for FlattenIRecordIterator<'a> {
type Item = &'a IValue;
fn next(&mut self) -> Option<Self::Item> {