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