This commit is contained in:
Alexandre Bury 2018-01-22 14:37:27 -08:00
parent 06086fdeb0
commit da8310b076
26 changed files with 65 additions and 140 deletions

View File

@ -1,13 +1,12 @@
extern crate cursive; extern crate cursive;
use cursive::Cursive; use cursive::Cursive;
use cursive::views::{Dialog, TextView};
use cursive::theme::Color;
use cursive::theme::BaseColor; use cursive::theme::BaseColor;
use cursive::theme::Style; use cursive::theme::Color;
use cursive::theme::Effect; use cursive::theme::Effect;
use cursive::theme::Style;
use cursive::utils::markup::StyledString; use cursive::utils::markup::StyledString;
use cursive::views::{Dialog, TextView};
fn main() { fn main() {
let mut siv = Cursive::new(); let mut siv = Cursive::new();

View File

@ -17,7 +17,6 @@ fn main() {
// We can quit by pressing `q` // We can quit by pressing `q`
siv.add_global_callback('q', Cursive::quit); siv.add_global_callback('q', Cursive::quit);
siv.add_layer(TextView::new( siv.add_layer(TextView::new(
"Hello World with default terminal background color!\n\ "Hello World with default terminal background color!\n\
Press q to quit the application.", Press q to quit the application.",

View File

@ -22,10 +22,7 @@ pub struct Concrete {
impl Concrete { impl Concrete {
fn blt_keycode_to_ev( fn blt_keycode_to_ev(
&mut self, &mut self, kc: KeyCode, shift: bool, ctrl: bool
kc: KeyCode,
shift: bool,
ctrl: bool,
) -> Event { ) -> Event {
match kc { match kc {
KeyCode::F1 KeyCode::F1

View File

@ -24,9 +24,7 @@ pub struct Concrete {
impl Concrete { impl Concrete {
/// Save a new color pair. /// Save a new color pair.
fn insert_color( fn insert_color(
&self, &self, pairs: &mut HashMap<ColorPair, i16>, pair: ColorPair
pairs: &mut HashMap<ColorPair, i16>,
pair: ColorPair,
) -> i16 { ) -> i16 {
let n = 1 + pairs.len() as i16; let n = 1 + pairs.len() as i16;
let target = if ncurses::COLOR_PAIRS() > i32::from(n) { let target = if ncurses::COLOR_PAIRS() > i32::from(n) {
@ -91,12 +89,10 @@ impl Concrete {
| ncurses::BUTTON_CTRL) | ncurses::BUTTON_CTRL)
as mmask_t; as mmask_t;
let make_event = |event| { let make_event = |event| Event::Mouse {
Event::Mouse {
offset: Vec2::zero(), offset: Vec2::zero(),
position: Vec2::new(mevent.x as usize, mevent.y as usize), position: Vec2::new(mevent.x as usize, mevent.y as usize),
event: event, event: event,
}
}; };
if mevent.bstate == ncurses::REPORT_MOUSE_POSITION as mmask_t { if mevent.bstate == ncurses::REPORT_MOUSE_POSITION as mmask_t {

View File

@ -22,9 +22,7 @@ pub struct Concrete {
impl Concrete { impl Concrete {
/// Save a new color pair. /// Save a new color pair.
fn insert_color( fn insert_color(
&self, &self, pairs: &mut HashMap<ColorPair, i32>, pair: ColorPair
pairs: &mut HashMap<ColorPair, i32>,
pair: ColorPair,
) -> i32 { ) -> i32 {
let n = 1 + pairs.len() as i32; let n = 1 + pairs.len() as i32;
@ -82,12 +80,10 @@ impl Concrete {
mevent.bstate &= !(pancurses::BUTTON_SHIFT | pancurses::BUTTON_ALT mevent.bstate &= !(pancurses::BUTTON_SHIFT | pancurses::BUTTON_ALT
| pancurses::BUTTON_CTRL) as mmask_t; | pancurses::BUTTON_CTRL) as mmask_t;
let make_event = |event| { let make_event = |event| Event::Mouse {
Event::Mouse {
offset: Vec2::zero(), offset: Vec2::zero(),
position: Vec2::new(mevent.x as usize, mevent.y as usize), position: Vec2::new(mevent.x as usize, mevent.y as usize),
event: event, event: event,
}
}; };
if mevent.bstate == pancurses::REPORT_MOUSE_POSITION as mmask_t { if mevent.bstate == pancurses::REPORT_MOUSE_POSITION as mmask_t {

View File

@ -175,8 +175,7 @@ impl Cursive {
/// ///
/// `filename` must point to a valid toml file. /// `filename` must point to a valid toml file.
pub fn load_theme_file<P: AsRef<Path>>( pub fn load_theme_file<P: AsRef<Path>>(
&mut self, &mut self, filename: P
filename: P,
) -> Result<(), theme::Error> { ) -> Result<(), theme::Error> {
self.set_theme(try!(theme::load_theme_file(filename))); self.set_theme(try!(theme::load_theme_file(filename)));
Ok(()) Ok(())
@ -281,9 +280,7 @@ impl Cursive {
/// # } /// # }
/// ``` /// ```
pub fn call_on<V, F, R>( pub fn call_on<V, F, R>(
&mut self, &mut self, sel: &view::Selector, callback: F
sel: &view::Selector,
callback: F,
) -> Option<R> ) -> Option<R>
where where
V: View + Any, V: View + Any,

View File

@ -33,9 +33,7 @@ impl<'a> Printer<'a> {
/// But nobody needs to know that. /// But nobody needs to know that.
#[doc(hidden)] #[doc(hidden)]
pub fn new<T: Into<Vec2>>( pub fn new<T: Into<Vec2>>(
size: T, size: T, theme: &'a Theme, backend: &'a backend::Concrete
theme: &'a Theme,
backend: &'a backend::Concrete,
) -> Self { ) -> Self {
Printer { Printer {
offset: Vec2::zero(), offset: Vec2::zero(),
@ -204,10 +202,7 @@ impl<'a> Printer<'a> {
/// printer.print_box((0,0), (6,4), false); /// printer.print_box((0,0), (6,4), false);
/// ``` /// ```
pub fn print_box<T: Into<Vec2>, S: Into<Vec2>>( pub fn print_box<T: Into<Vec2>, S: Into<Vec2>>(
&self, &self, start: T, size: S, invert: bool
start: T,
size: S,
invert: bool,
) { ) {
self.new.set(false); self.new.set(false);
@ -304,10 +299,7 @@ impl<'a> Printer<'a> {
/// Returns a printer on a subset of this one's area. /// Returns a printer on a subset of this one's area.
pub fn sub_printer<S: Into<Vec2>, T: Into<Vec2>>( pub fn sub_printer<S: Into<Vec2>, T: Into<Vec2>>(
&'a self, &'a self, offset: S, size: T, focused: bool
offset: S,
size: T,
focused: bool,
) -> Printer<'a> { ) -> Printer<'a> {
let size = size.into(); let size = size.into();
let offset = offset.into().or_min(self.size); let offset = offset.into().or_min(self.size);

View File

@ -3,9 +3,7 @@ use std::iter::Peekable;
/// Concatenates chunks as long as they fit in the given width. /// Concatenates chunks as long as they fit in the given width.
pub fn prefix<'a, I>( pub fn prefix<'a, I>(
tokens: &mut Peekable<I>, tokens: &mut Peekable<I>, width: usize, offset: &mut ChunkPart
width: usize,
offset: &mut ChunkPart,
) -> Vec<Chunk<'a>> ) -> Vec<Chunk<'a>>
where where
I: Iterator<Item = Chunk<'a>>, I: Iterator<Item = Chunk<'a>>,

View File

@ -13,8 +13,7 @@ pub struct Row {
impl Row { impl Row {
/// Resolve the row indices into string slices and attributes. /// Resolve the row indices into string slices and attributes.
pub fn resolve<'a, T>( pub fn resolve<'a, T>(
&self, &self, source: &'a SpannedString<T>
source: &'a SpannedString<T>,
) -> Vec<Span<'a, T>> { ) -> Vec<Span<'a, T>> {
self.segments self.segments
.iter() .iter()

View File

@ -6,7 +6,6 @@
pub mod markdown; pub mod markdown;
use theme::Style; use theme::Style;
use utils::span::{IndexedSpan, Span, SpannedString}; use utils::span::{IndexedSpan, Span, SpannedString};
/// A parsed string with markup style. /// A parsed string with markup style.

View File

@ -284,7 +284,7 @@ impl From<((i32, i32), (i32, i32))> for Vec4 {
} }
impl From<((usize, usize), (usize, usize))> for Vec4 { impl From<((usize, usize), (usize, usize))> for Vec4 {
fn from( fn from(
((left, right), (top, bottom)): ((usize, usize), (usize, usize)), ((left, right), (top, bottom)): ((usize, usize), (usize, usize))
) -> Vec4 { ) -> Vec4 {
(left, right, top, bottom).into() (left, right, top, bottom).into()
} }

View File

@ -8,9 +8,7 @@ use views::BoxView;
pub trait Boxable: View + Sized { pub trait Boxable: View + Sized {
/// Wraps `self` in a `BoxView` with the given size constraints. /// Wraps `self` in a `BoxView` with the given size constraints.
fn boxed( fn boxed(
self, self, width: SizeConstraint, height: SizeConstraint
width: SizeConstraint,
height: SizeConstraint,
) -> BoxView<Self> { ) -> BoxView<Self> {
BoxView::new(width, height, self) BoxView::new(width, height, self)
} }

View File

@ -94,7 +94,6 @@ pub trait View: Any {
EventResult::Ignored EventResult::Ignored
} }
/// Returns the minimum size the view requires with the given restrictions. /// Returns the minimum size the view requires with the given restrictions.
/// ///
/// If the view is flexible (it has multiple size options), it can try /// If the view is flexible (it has multiple size options), it can try

View File

@ -30,10 +30,7 @@ impl Position {
/// child with its top-left corner at the returned coordinates will /// child with its top-left corner at the returned coordinates will
/// position him appropriately. /// position him appropriately.
pub fn compute_offset<S, A, P>( pub fn compute_offset<S, A, P>(
&self, &self, size: S, available: A, parent: P
size: S,
available: A,
parent: P,
) -> Vec2 ) -> Vec2
where where
S: Into<Vec2>, S: Into<Vec2>,
@ -68,10 +65,7 @@ pub enum Offset {
impl Offset { impl Offset {
/// Computes a single-dimension offset requred to draw a view. /// Computes a single-dimension offset requred to draw a view.
pub fn compute_offset( pub fn compute_offset(
&self, &self, size: usize, available: usize, parent: usize
size: usize,
available: usize,
parent: usize,
) -> usize { ) -> usize {
if size > available { if size > available {
0 0

View File

@ -78,9 +78,7 @@ pub trait ViewWrapper: 'static {
/// Wraps the `find` method. /// Wraps the `find` method.
fn wrap_call_on_any<'a>( fn wrap_call_on_any<'a>(
&mut self, &mut self, selector: &Selector, callback: Box<FnMut(&mut Any) + 'a>
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
self.with_view_mut(|v| v.call_on_any(selector, callback)); self.with_view_mut(|v| v.call_on_any(selector, callback));
} }
@ -146,9 +144,7 @@ impl<T: ViewWrapper> View for T {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector, callback: Box<FnMut(&mut Any) + 'a>
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
self.wrap_call_on_any(selector, callback) self.wrap_call_on_any(selector, callback)
} }

View File

@ -39,9 +39,7 @@ impl<T: View> BoxView<T> {
/// ///
/// `None` values will use the wrapped view's preferences. /// `None` values will use the wrapped view's preferences.
pub fn new( pub fn new(
width: SizeConstraint, width: SizeConstraint, height: SizeConstraint, view: T
height: SizeConstraint,
view: T,
) -> Self { ) -> Self {
BoxView { BoxView {
size: (width, height).into(), size: (width, height).into(),

View File

@ -32,8 +32,7 @@ impl Checkbox {
/// Sets a callback to be used when the state changes. /// Sets a callback to be used when the state changes.
pub fn set_on_change<F: 'static + Fn(&mut Cursive, bool)>( pub fn set_on_change<F: 'static + Fn(&mut Cursive, bool)>(
&mut self, &mut self, on_change: F
on_change: F,
) { ) {
self.on_change = Some(Rc::new(on_change)); self.on_change = Some(Rc::new(on_change));
} }
@ -42,8 +41,7 @@ impl Checkbox {
/// ///
/// Chainable variant. /// Chainable variant.
pub fn on_change<F: 'static + Fn(&mut Cursive, bool)>( pub fn on_change<F: 'static + Fn(&mut Cursive, bool)>(
self, self, on_change: F
on_change: F,
) -> Self { ) -> Self {
self.with(|s| s.set_on_change(on_change)) self.with(|s| s.set_on_change(on_change))
} }

View File

@ -108,7 +108,11 @@ impl Dialog {
/// ``` /// ```
/// use cursive::views::{Dialog, TextView}; /// use cursive::views::{Dialog, TextView};
/// let dialog = Dialog::around(TextView::new("Hello!")); /// let dialog = Dialog::around(TextView::new("Hello!"));
/// let text_view: &TextView = dialog.get_content().as_any().downcast_ref::<TextView>().unwrap(); /// let text_view: &TextView = dialog
/// .get_content()
/// .as_any()
/// .downcast_ref::<TextView>()
/// .unwrap();
/// assert_eq!(text_view.get_content().source(), "Hello!"); /// assert_eq!(text_view.get_content().source(), "Hello!");
/// ``` /// ```
pub fn get_content(&self) -> &AnyView { pub fn get_content(&self) -> &AnyView {
@ -235,7 +239,7 @@ impl Dialog {
/// Returns an iterator on this buttons for this dialog. /// Returns an iterator on this buttons for this dialog.
pub fn buttons_mut<'a>( pub fn buttons_mut<'a>(
&'a mut self, &'a mut self
) -> Box<'a + Iterator<Item = &'a mut Button>> { ) -> Box<'a + Iterator<Item = &'a mut Button>> {
Box::new(self.buttons.iter_mut().map(|b| &mut b.button.view)) Box::new(self.buttons.iter_mut().map(|b| &mut b.button.view))
} }
@ -265,9 +269,7 @@ impl Dialog {
// An event is received while a button is in focus // An event is received while a button is in focus
fn on_event_button( fn on_event_button(
&mut self, &mut self, event: Event, button_id: usize
event: Event,
button_id: usize,
) -> EventResult { ) -> EventResult {
let result = { let result = {
let button = &mut self.buttons[button_id]; let button = &mut self.buttons[button_id];
@ -550,9 +552,7 @@ impl View for Dialog {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector, callback: Box<FnMut(&mut Any) + 'a>
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
self.content.call_on_any(selector, callback); self.content.call_on_any(selector, callback);
} }

View File

@ -436,11 +436,9 @@ fn make_small_stars(length: usize) -> &'static str {
impl View for EditView { impl View for EditView {
fn draw(&self, printer: &Printer) { fn draw(&self, printer: &Printer) {
assert_eq!( assert_eq!(
printer.size.x, printer.size.x, self.last_length,
self.last_length,
"Was promised {}, received {}", "Was promised {}, received {}",
self.last_length, self.last_length, printer.size.x
printer.size.x
); );
let width = self.content.width(); let width = self.content.width();
@ -513,8 +511,7 @@ impl View for EditView {
.next() .next()
.expect(&format!( .expect(&format!(
"Found no char at cursor {} in {}", "Found no char at cursor {} in {}",
self.cursor, self.cursor, &self.content
&self.content
)); ));
if self.secret { if self.secret {
make_small_stars(selected.width()) make_small_stars(selected.width())

View File

@ -77,9 +77,7 @@ impl<T: View + 'static> ViewWrapper for IdView<T> {
// Some for<'b> weirdness here to please the borrow checker gods... // Some for<'b> weirdness here to please the borrow checker gods...
fn wrap_call_on_any<'a>( fn wrap_call_on_any<'a>(
&mut self, &mut self, selector: &Selector, mut callback: BoxedCallback<'a>
selector: &Selector,
mut callback: BoxedCallback<'a>,
) { ) {
match selector { match selector {
&Selector::Id(id) if id == self.id => callback(self), &Selector::Id(id) if id == self.id => callback(self),

View File

@ -57,9 +57,7 @@ struct ChildItem<T> {
impl<T> ChildIterator<T> { impl<T> ChildIterator<T> {
fn new( fn new(
inner: T, inner: T, orientation: direction::Orientation, available: usize
orientation: direction::Orientation,
available: usize,
) -> Self { ) -> Self {
ChildIterator { ChildIterator {
inner, inner,
@ -71,7 +69,8 @@ impl<T> ChildIterator<T> {
} }
impl<'a, T: Deref<Target = Child>, I: Iterator<Item = T>> Iterator impl<'a, T: Deref<Target = Child>, I: Iterator<Item = T>> Iterator
for ChildIterator<I> { for ChildIterator<I>
{
type Item = ChildItem<T>; type Item = ChildItem<T>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -199,9 +198,7 @@ impl LinearLayout {
/// Returns a cyclic mutable iterator starting with the child in focus /// Returns a cyclic mutable iterator starting with the child in focus
fn iter_mut<'a>( fn iter_mut<'a>(
&'a mut self, &'a mut self, from_focus: bool, source: direction::Relative
from_focus: bool,
source: direction::Relative,
) -> Box<Iterator<Item = (usize, &mut Child)> + 'a> { ) -> Box<Iterator<Item = (usize, &mut Child)> + 'a> {
match source { match source {
direction::Relative::Front => { direction::Relative::Front => {
@ -290,8 +287,7 @@ impl LinearLayout {
} }
fn try_focus( fn try_focus(
(i, child): (usize, &mut Child), (i, child): (usize, &mut Child), source: direction::Direction
source: direction::Direction,
) -> Option<usize> { ) -> Option<usize> {
if child.view.take_focus(source) { if child.view.take_focus(source) {
Some(i) Some(i)
@ -553,8 +549,7 @@ impl View for LinearLayout {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector,
selector: &Selector,
mut callback: Box<FnMut(&mut Any) + 'a>, mut callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
for child in &mut self.children { for child in &mut self.children {

View File

@ -148,9 +148,7 @@ impl ListView {
} }
fn iter_mut<'a>( fn iter_mut<'a>(
&'a mut self, &'a mut self, from_focus: bool, source: direction::Relative
from_focus: bool,
source: direction::Relative,
) -> Box<Iterator<Item = (usize, &mut ListChild)> + 'a> { ) -> Box<Iterator<Item = (usize, &mut ListChild)> + 'a> {
match source { match source {
direction::Relative::Front => { direction::Relative::Front => {
@ -174,9 +172,7 @@ impl ListView {
} }
fn move_focus( fn move_focus(
&mut self, &mut self, n: usize, source: direction::Direction
n: usize,
source: direction::Direction,
) -> EventResult { ) -> EventResult {
let i = if let Some(i) = source let i = if let Some(i) = source
.relative(direction::Orientation::Vertical) .relative(direction::Orientation::Vertical)
@ -250,8 +246,7 @@ impl ListView {
} }
fn try_focus( fn try_focus(
(i, child): (usize, &mut ListChild), (i, child): (usize, &mut ListChild), source: direction::Direction
source: direction::Direction,
) -> Option<usize> { ) -> Option<usize> {
match *child { match *child {
ListChild::Delimiter => None, ListChild::Delimiter => None,
@ -454,8 +449,7 @@ impl View for ListView {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector,
selector: &Selector,
mut callback: Box<FnMut(&mut Any) + 'a>, mut callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
for view in self.children.iter_mut().filter_map(ListChild::view) { for view in self.children.iter_mut().filter_map(ListChild::view) {

View File

@ -106,10 +106,7 @@ impl Menubar {
/// Insert a new item at the given position. /// Insert a new item at the given position.
pub fn insert_subtree<S>( pub fn insert_subtree<S>(
&mut self, &mut self, i: usize, title: S, menu: MenuTree
i: usize,
title: S,
menu: MenuTree,
) -> &mut Self ) -> &mut Self
where where
S: Into<String>, S: Into<String>,

View File

@ -123,8 +123,7 @@ impl ProgressBar {
/// ///
/// Chainable variant. /// Chainable variant.
pub fn with_task<F: FnOnce(Counter) + Send + 'static>( pub fn with_task<F: FnOnce(Counter) + Send + 'static>(
mut self, mut self, task: F
task: F,
) -> Self { ) -> Self {
self.start(task); self.start(task);
self self
@ -144,8 +143,7 @@ impl ProgressBar {
/// } /// }
/// ``` /// ```
pub fn with_label<F: Fn(usize, (usize, usize)) -> String + 'static>( pub fn with_label<F: Fn(usize, (usize, usize)) -> String + 'static>(
mut self, mut self, label_maker: F
label_maker: F,
) -> Self { ) -> Self {
self.label_maker = Box::new(label_maker); self.label_maker = Box::new(label_maker);
self self

View File

@ -52,9 +52,7 @@ impl<T> RadioGroup<T> {
/// ///
/// The button will display `label` next to it, and will embed `value`. /// The button will display `label` next to it, and will embed `value`.
pub fn button<S: Into<String>>( pub fn button<S: Into<String>>(
&mut self, &mut self, value: T, label: S
value: T,
label: S,
) -> RadioButton<T> { ) -> RadioButton<T> {
let count = self.state.borrow().values.len(); let count = self.state.borrow().values.len();
self.state.borrow_mut().values.push(Rc::new(value)); self.state.borrow_mut().values.push(Rc::new(value));
@ -77,8 +75,7 @@ impl<T> RadioGroup<T> {
impl RadioGroup<String> { impl RadioGroup<String> {
/// Adds a button, using the label itself as value. /// Adds a button, using the label itself as value.
pub fn button_str<S: Into<String>>( pub fn button_str<S: Into<String>>(
&mut self, &mut self, text: S
text: S,
) -> RadioButton<String> { ) -> RadioButton<String> {
let text = text.into(); let text = text.into();
self.button(text.clone(), text) self.button(text.clone(), text)
@ -107,9 +104,7 @@ impl<T> RadioButton<T> {
impl_enabled!(self.enabled); impl_enabled!(self.enabled);
fn new( fn new(
state: Rc<RefCell<SharedState<T>>>, state: Rc<RefCell<SharedState<T>>>, id: usize, label: String
id: usize,
label: String,
) -> Self { ) -> Self {
RadioButton { RadioButton {
state: state, state: state,

View File

@ -33,10 +33,7 @@ pub enum LayerPosition {
impl Placement { impl Placement {
pub fn compute_offset<S, A, P>( pub fn compute_offset<S, A, P>(
&self, &self, size: S, available: A, parent: P
size: S,
available: A,
parent: P,
) -> Vec2 ) -> Vec2
where where
S: Into<Vec2>, S: Into<Vec2>,
@ -110,9 +107,7 @@ impl<T: View> View for ChildWrapper<T> {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector, callback: Box<FnMut(&mut Any) + 'a>
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
match *self { match *self {
ChildWrapper::Shadow(ref mut v) => { ChildWrapper::Shadow(ref mut v) => {
@ -294,7 +289,8 @@ struct StackPositionIterator<R: Deref<Target = Child>, I: Iterator<Item = R>> {
} }
impl<R: Deref<Target = Child>, I: Iterator<Item = R>> impl<R: Deref<Target = Child>, I: Iterator<Item = R>>
StackPositionIterator<R, I> { StackPositionIterator<R, I>
{
/// Returns a new StackPositionIterator /// Returns a new StackPositionIterator
pub fn new(inner: I, total_size: Vec2) -> Self { pub fn new(inner: I, total_size: Vec2) -> Self {
let previous = Vec2::zero(); let previous = Vec2::zero();
@ -307,7 +303,8 @@ impl<R: Deref<Target = Child>, I: Iterator<Item = R>>
} }
impl<R: Deref<Target = Child>, I: Iterator<Item = R>> Iterator impl<R: Deref<Target = Child>, I: Iterator<Item = R>> Iterator
for StackPositionIterator<R, I> { for StackPositionIterator<R, I>
{
type Item = (R, Vec2); type Item = (R, Vec2);
fn next(&mut self) -> Option<(R, Vec2)> { fn next(&mut self) -> Option<(R, Vec2)> {
@ -396,8 +393,7 @@ impl View for StackView {
} }
fn call_on_any<'a>( fn call_on_any<'a>(
&mut self, &mut self, selector: &Selector,
selector: &Selector,
mut callback: Box<FnMut(&mut Any) + 'a>, mut callback: Box<FnMut(&mut Any) + 'a>,
) { ) {
for layer in &mut self.layers { for layer in &mut self.layers {