diff --git a/src/object/vector/rep.rs b/src/object/vector/rep.rs index fc48e17..1422edf 100644 --- a/src/object/vector/rep.rs +++ b/src/object/vector/rep.rs @@ -154,16 +154,16 @@ pub struct IntoIterableRefNames { iter: Box>>, } -pub struct RepIterableNames<'a> { +pub struct IterableNames<'a> { names: &'a [Character], na_name: &'a Character, iter: &'a mut Box>>, } impl IntoIterableRefNames { - pub fn iter(&mut self) -> RepIterableNames<'_> { + pub fn iter(&mut self) -> IterableNames<'_> { let names = &self.names[..]; - RepIterableNames { + IterableNames { names, na_name: &self.na_name, iter: &mut self.iter, @@ -171,7 +171,7 @@ impl IntoIterableRefNames { } } -impl<'a> Iterator for RepIterableNames<'a> { +impl<'a> Iterator for IterableNames<'a> { type Item = &'a Character; fn next(&mut self) -> Option { @@ -390,9 +390,8 @@ impl Rep { } } - /// Get an `Option>` which in turn can be converted into an iterator over - /// references to the values. - /// The `None` variant is returned if the `Rep` is not named. + /// Get an `IntoIterableValues` which in turn can be converted into an iterator over + /// references to the values (`&T`). /// /// Directly getting an iterator is not possible due to lifetime issues. pub fn values_ref(&self) -> IntoIterableRefValues { @@ -406,8 +405,9 @@ impl Rep { } } - /// Get an `RepTypeIntoIterableValues` which in turn can be converted into an iterator over - /// references to the names. + /// Get an `Option` which in turn can be converted into an iterator over + /// references to the names (`&String`). + /// None is returned when no names exist. /// /// Directly getting an iterator is not possible due to lifetime issues. pub fn names_ref(&self) -> Option { @@ -422,8 +422,8 @@ impl Rep { } } - /// Get an `RepTypeIntoIterablePairs` which in turn can be converted into an iterator over - /// pairs of references (&name, &value). + /// Get an `IntoIterablePairs` which in turn can be converted into an iterator over + /// pairs of references (`(&String, &T)`). /// /// Directly getting an iterator is not possible due to lifetime issues. pub fn pairs_ref(&self) -> IntoIterableRefPairs { @@ -444,6 +444,7 @@ impl Rep { } } + /// Iterate over (owned) pairs of names and values (`(String, T)`). pub fn iter_pairs(&self) -> IterablePairs { match self.clone() { Rep::Subset(values, _, maybe_naming) => {