pub trait AssocVisitor: Sized + Sealed {
type Result;
// Required methods
fn visit_entry<K: Display, V: Display>(
&mut self,
key: K,
value: V,
) -> ControlFlow<Self::Result>;
fn finish(self) -> Self::Result;
// Provided method
fn visit_entries_and_finish<K, V, I>(self, entries: I) -> Self::Result
where K: Display,
V: Display,
I: IntoIterator<Item = (K, V)> { ... }
}
Expand description
Associative array visitor.
See the module documentation for usage.
Required Associated Types§
Required Methods§
sourcefn visit_entry<K: Display, V: Display>(
&mut self,
key: K,
value: V,
) -> ControlFlow<Self::Result>
fn visit_entry<K: Display, V: Display>( &mut self, key: K, value: V, ) -> ControlFlow<Self::Result>
Visits an entry.
If this returned ControlFlow::Break(v)
, Context::visit
should also
return this v
.
To feed multiple items at once, do
entries.into_iter().try_for_each(|(key, value)| self.visit_entry(key, value))
for example.
Provided Methods§
sourcefn visit_entries_and_finish<K, V, I>(self, entries: I) -> Self::Result
fn visit_entries_and_finish<K, V, I>(self, entries: I) -> Self::Result
Visits entries and finish.
Object Safety§
This trait is not object safe.