Lazy_load: improve the naming scheme.

This commit is contained in:
Jordan Petridis 2018-04-07 05:50:34 +03:00 committed by Merge Bot, Bors Wannabe
parent 5069430a3a
commit 4b4f5c39d4

View File

@ -395,18 +395,18 @@ pub fn episodes_listbox(pd: Arc<Podcast>, sender: Sender<Action>) -> Result<gtk:
use gtk::{IsA, Widget}; use gtk::{IsA, Widget};
fn lazy_load<T, U, P, Z>(data: T, container: Z, mut predicate: P) fn lazy_load<T, C, F, W>(data: T, container: C, mut contructor: F)
where where
T: IntoIterator + 'static, T: IntoIterator + 'static,
T::Item: 'static, T::Item: 'static,
Z: ContainerExt + 'static, C: ContainerExt + 'static,
P: FnMut(T::Item) -> U + 'static, F: FnMut(T::Item) -> W + 'static,
U: IsA<Widget>, W: IsA<Widget>,
{ {
let mut data = data.into_iter(); let mut data = data.into_iter();
gtk::idle_add(move || { gtk::idle_add(move || {
data.next() data.next()
.map(|x| container.add(&predicate(x))) .map(|x| container.add(&contructor(x)))
.map(|_| glib::Continue(true)) .map(|_| glib::Continue(true))
.unwrap_or(glib::Continue(false)) .unwrap_or(glib::Continue(false))
}); });