pub struct TreeItem { /* private fields */ }
Expand description
Defines a tree item
Implementations§
source§impl TreeItem
impl TreeItem
sourcepub fn draw_item_content<F: FnMut(&mut Self, bool) -> i32>(&mut self, cb: F)
pub fn draw_item_content<F: FnMut(&mut Self, bool) -> i32>(&mut self, cb: F)
Overrides the draw_item_content method Example usage:
use fltk::{draw, enums::*, tree};
let mut tree = tree::Tree::default();
let mut item = tree::TreeItem::new(&tree, "Hello");
item.draw_item_content(|item, render| {
// Our item's dimensions + text content
let x = item.label_x();
let y = item.label_y();
let w = item.label_w();
let h = item.label_h();
let txt = if let Some(txt) = item.label() {
txt
} else {
String::new()
};
if render {
// Draw bg -- a filled rectangle
draw::draw_rect_fill(x, y, w, h, item.label_bgcolor());
// Draw label
draw::set_font(Font::Helvetica, 14);
draw::set_draw_color(Color::ForeGround); // use recommended fg color
draw::draw_text2(&txt, x, y, w, h, Align::Left); // draw the item's label
}
// Rendered or not, we must calculate content's max X position
let (lw, _) = draw::measure(&txt, true); // get width of label text
return x + lw; // return X + label width
});
// Add our custom item to a path
let _third = tree.add_item("first/second/thrid", &item).unwrap();
sourcepub fn set_user_data<T: Clone + 'static>(&mut self, data: T)
pub fn set_user_data<T: Clone + 'static>(&mut self, data: T)
Set the internal data of the tree item
Warning
This method doesn’t store the type information of the passed data
sourcepub unsafe fn user_data<T: Clone + 'static>(&self) -> Option<T>
pub unsafe fn user_data<T: Clone + 'static>(&self) -> Option<T>
Get the stored data in the tree item
Safety
Setting the user data doesn’t store type information, as such it’s on the developer to maintain the correct type
sourcepub fn y(&self) -> i32
pub fn y(&self) -> i32
Gets the y position
Examples found in repository?
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
let mut t_widget = Tree::new(x, y, width, height, title);
let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
let pfr = Rc::clone(&previous_focus);
t_widget.set_callback_reason(TreeReason::Selected);
t_widget.set_callback(|_t| println!("clicked an item"));
t_widget.handle(move |t, e| match e {
Event::Move => {
let (_, mouse_y) = app::event_coords();
let mut state = State::Undefined;
let mut pf = pfr.borrow_mut();
loop {
match &*pf {
Some(item) => {
let item_y = item.y();
match state {
State::MovingUp => {
if verify_open_till_root(&pf) {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().prev();
continue;
}
}
State::MovingDown => {
if verify_open_till_root(&pf) {
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().next();
continue;
}
}
State::Undefined => {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
state = State::MovingUp;
continue;
};
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
state = State::MovingDown;
continue;
};
return true; // If in same range, don't update 'previous_focus'
}
}
}
// End up here if y is outside tree boundaries, or no tree item is present
None => match &state {
State::MovingUp | State::MovingDown => return true,
State::Undefined => {
*pf = t.first();
state = State::MovingDown;
if pf.is_none() {
return true;
}
continue;
}
},
};
}
if verify_open_till_root(&pf) {
t.take_focus().ok();
t.set_item_focus(pf.as_ref().unwrap());
println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
}
true
}
_ => false,
});
Self {
t_widget,
previous_focus,
}
}
sourcepub fn h(&self) -> i32
pub fn h(&self) -> i32
Gets the height
Examples found in repository?
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
let mut t_widget = Tree::new(x, y, width, height, title);
let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
let pfr = Rc::clone(&previous_focus);
t_widget.set_callback_reason(TreeReason::Selected);
t_widget.set_callback(|_t| println!("clicked an item"));
t_widget.handle(move |t, e| match e {
Event::Move => {
let (_, mouse_y) = app::event_coords();
let mut state = State::Undefined;
let mut pf = pfr.borrow_mut();
loop {
match &*pf {
Some(item) => {
let item_y = item.y();
match state {
State::MovingUp => {
if verify_open_till_root(&pf) {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().prev();
continue;
}
}
State::MovingDown => {
if verify_open_till_root(&pf) {
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().next();
continue;
}
}
State::Undefined => {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
state = State::MovingUp;
continue;
};
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
state = State::MovingDown;
continue;
};
return true; // If in same range, don't update 'previous_focus'
}
}
}
// End up here if y is outside tree boundaries, or no tree item is present
None => match &state {
State::MovingUp | State::MovingDown => return true,
State::Undefined => {
*pf = t.first();
state = State::MovingDown;
if pf.is_none() {
return true;
}
continue;
}
},
};
}
if verify_open_till_root(&pf) {
t.take_focus().ok();
t.set_item_focus(pf.as_ref().unwrap());
println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
}
true
}
_ => false,
});
Self {
t_widget,
previous_focus,
}
}
sourcepub fn set_label(&mut self, val: &str)
pub fn set_label(&mut self, val: &str)
Sets the label of the tree item
Examples found in repository?
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
fn main() {
let path = env::current_dir().unwrap();
let path: String = path
.to_str()
.unwrap()
.chars()
.enumerate()
.map(|(_, c)| match c {
'\\' => '/', // change window paths to posix paths
_ => c,
})
.collect();
let app = app::App::default().with_scheme(app::Scheme::Gtk);
let mut wind = Window::default().with_size(400, 300);
let mut but = Button::new(260, 255, 80, 40, "Get Items");
let _frame = Frame::new(20, 255, 160, 40, "Focus follow mouse");
let mut tree = TreeMouseFocus::new(5, 10, 190, 240, "");
tree.add(&path);
let mut items = tree.get_items().unwrap();
items.as_mut_slice()[0].set_label("/");
let mut tree2 = Tree::new(205, 10, 190, 240, "");
tree2.set_select_mode(TreeSelect::Multi);
tree2.add("First");
tree2.add("First/1st");
tree2.add("First/2nd/3rd");
tree2.add("Second");
tree2.add("Third");
tree2.set_trigger(fltk::enums::CallbackTrigger::ReleaseAlways);
wind.make_resizable(true);
wind.show();
but.set_callback({
let tree2 = tree2.clone();
move |_| match tree2.get_selected_items() {
None => println!("No items selected"),
Some(vals) => print!(
"In total {} items selected:\n{}",
vals.len(),
vals.iter()
.map(|i| tree2.item_pathname(i).unwrap() + "\n")
.collect::<String>()
),
}
});
app.run().unwrap();
}
sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Gets the label of the tree item
Examples found in repository?
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
let mut t_widget = Tree::new(x, y, width, height, title);
let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
let pfr = Rc::clone(&previous_focus);
t_widget.set_callback_reason(TreeReason::Selected);
t_widget.set_callback(|_t| println!("clicked an item"));
t_widget.handle(move |t, e| match e {
Event::Move => {
let (_, mouse_y) = app::event_coords();
let mut state = State::Undefined;
let mut pf = pfr.borrow_mut();
loop {
match &*pf {
Some(item) => {
let item_y = item.y();
match state {
State::MovingUp => {
if verify_open_till_root(&pf) {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().prev();
continue;
}
}
State::MovingDown => {
if verify_open_till_root(&pf) {
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().next();
continue;
}
}
State::Undefined => {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
state = State::MovingUp;
continue;
};
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
state = State::MovingDown;
continue;
};
return true; // If in same range, don't update 'previous_focus'
}
}
}
// End up here if y is outside tree boundaries, or no tree item is present
None => match &state {
State::MovingUp | State::MovingDown => return true,
State::Undefined => {
*pf = t.first();
state = State::MovingDown;
if pf.is_none() {
return true;
}
continue;
}
},
};
}
if verify_open_till_root(&pf) {
t.take_focus().ok();
t.set_item_focus(pf.as_ref().unwrap());
println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
}
true
}
_ => false,
});
Self {
t_widget,
previous_focus,
}
}
sourcepub fn set_label_font(&mut self, val: Font)
pub fn set_label_font(&mut self, val: Font)
Sets the label’s font
sourcepub fn label_font(&self) -> Font
pub fn label_font(&self) -> Font
Gets the label’s font
sourcepub fn set_label_size(&mut self, sz: i32)
pub fn set_label_size(&mut self, sz: i32)
Sets the label’s size
sourcepub fn label_size(&self) -> i32
pub fn label_size(&self) -> i32
Gets the label’s size
sourcepub fn set_label_fgcolor(&mut self, val: Color)
pub fn set_label_fgcolor(&mut self, val: Color)
Sets the label’s foreground color
sourcepub fn label_fgcolor(&self) -> Color
pub fn label_fgcolor(&self) -> Color
Gets the label’s foreground color
sourcepub fn set_label_fg_color(&mut self, val: Color)
👎Deprecated since 1.2.19: please use set_label_fgcolor
instead
pub fn set_label_fg_color(&mut self, val: Color)
set_label_fgcolor
insteadSets the label’s foreground color
sourcepub fn label_fg_color(&self) -> Color
👎Deprecated since 1.2.19: please use label_fgcolor
instead
pub fn label_fg_color(&self) -> Color
label_fgcolor
insteadGets the label’s foreground color
sourcepub fn set_label_color(&mut self, val: Color)
pub fn set_label_color(&mut self, val: Color)
Sets the label’s color
sourcepub fn label_color(&self) -> Color
pub fn label_color(&self) -> Color
Gets the label’s color
sourcepub fn set_label_bgcolor(&mut self, val: Color)
pub fn set_label_bgcolor(&mut self, val: Color)
Sets the label’s background color
sourcepub fn label_bgcolor(&self) -> Color
pub fn label_bgcolor(&self) -> Color
Gets the label’s foreground color
sourcepub fn set_widget<W: WidgetExt>(&mut self, val: &W)
pub fn set_widget<W: WidgetExt>(&mut self, val: &W)
Sets the item’s associated widget
sourcepub fn widget(&self) -> Widget
👎Deprecated since 1.2.18: please use try_widget
instead
pub fn widget(&self) -> Widget
try_widget
insteadGets the item’s associated widget
sourcepub fn try_widget(&self) -> Option<impl WidgetExt>
pub fn try_widget(&self) -> Option<impl WidgetExt>
Gets the item’s associated widget
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Returns whether the item has children
sourcepub fn clear_children(&mut self)
pub fn clear_children(&mut self)
Remove all children
sourcepub fn find_child_item(&self, name: &str) -> Option<TreeItem>
pub fn find_child_item(&self, name: &str) -> Option<TreeItem>
Find child by name, returns option of the item
sourcepub fn replace_child(
&mut self,
old_item: &TreeItem,
new_item: &TreeItem
) -> Option<TreeItem>
pub fn replace_child( &mut self, old_item: &TreeItem, new_item: &TreeItem ) -> Option<TreeItem>
Replace a child
sourcepub fn prev(&self) -> Option<TreeItem>
pub fn prev(&self) -> Option<TreeItem>
Gets the previous item
Examples found in repository?
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
let mut t_widget = Tree::new(x, y, width, height, title);
let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
let pfr = Rc::clone(&previous_focus);
t_widget.set_callback_reason(TreeReason::Selected);
t_widget.set_callback(|_t| println!("clicked an item"));
t_widget.handle(move |t, e| match e {
Event::Move => {
let (_, mouse_y) = app::event_coords();
let mut state = State::Undefined;
let mut pf = pfr.borrow_mut();
loop {
match &*pf {
Some(item) => {
let item_y = item.y();
match state {
State::MovingUp => {
if verify_open_till_root(&pf) {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().prev();
continue;
}
}
State::MovingDown => {
if verify_open_till_root(&pf) {
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().next();
continue;
}
}
State::Undefined => {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
state = State::MovingUp;
continue;
};
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
state = State::MovingDown;
continue;
};
return true; // If in same range, don't update 'previous_focus'
}
}
}
// End up here if y is outside tree boundaries, or no tree item is present
None => match &state {
State::MovingUp | State::MovingDown => return true,
State::Undefined => {
*pf = t.first();
state = State::MovingDown;
if pf.is_none() {
return true;
}
continue;
}
},
};
}
if verify_open_till_root(&pf) {
t.take_focus().ok();
t.set_item_focus(pf.as_ref().unwrap());
println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
}
true
}
_ => false,
});
Self {
t_widget,
previous_focus,
}
}
sourcepub fn next(&self) -> Option<TreeItem>
pub fn next(&self) -> Option<TreeItem>
Gets the next item
Examples found in repository?
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
let mut t_widget = Tree::new(x, y, width, height, title);
let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
let pfr = Rc::clone(&previous_focus);
t_widget.set_callback_reason(TreeReason::Selected);
t_widget.set_callback(|_t| println!("clicked an item"));
t_widget.handle(move |t, e| match e {
Event::Move => {
let (_, mouse_y) = app::event_coords();
let mut state = State::Undefined;
let mut pf = pfr.borrow_mut();
loop {
match &*pf {
Some(item) => {
let item_y = item.y();
match state {
State::MovingUp => {
if verify_open_till_root(&pf) {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().prev();
continue;
}
}
State::MovingDown => {
if verify_open_till_root(&pf) {
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
continue;
};
break;
} else {
*pf = pf.as_ref().unwrap().next();
continue;
}
}
State::Undefined => {
if mouse_y < item_y {
*pf = pf.as_ref().unwrap().prev();
state = State::MovingUp;
continue;
};
if mouse_y > item_y + item.h() {
*pf = pf.as_ref().unwrap().next();
state = State::MovingDown;
continue;
};
return true; // If in same range, don't update 'previous_focus'
}
}
}
// End up here if y is outside tree boundaries, or no tree item is present
None => match &state {
State::MovingUp | State::MovingDown => return true,
State::Undefined => {
*pf = t.first();
state = State::MovingDown;
if pf.is_none() {
return true;
}
continue;
}
},
};
}
if verify_open_till_root(&pf) {
t.take_focus().ok();
t.set_item_focus(pf.as_ref().unwrap());
println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
}
true
}
_ => false,
});
Self {
t_widget,
previous_focus,
}
}
sourcepub fn next_sibling(&self) -> Option<TreeItem>
pub fn next_sibling(&self) -> Option<TreeItem>
Gets the next sibling
sourcepub fn prev_sibling(&self) -> Option<TreeItem>
pub fn prev_sibling(&self) -> Option<TreeItem>
Gets the previous sibling
sourcepub fn update_prev_next(&mut self, index: i32)
pub fn update_prev_next(&mut self, index: i32)
Update surrounding siblings
sourcepub fn parent(&self) -> Option<TreeItem>
pub fn parent(&self) -> Option<TreeItem>
Return the parent of the item
Examples found in repository?
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
fn verify_open_till_root(opt: &Option<fltk::tree::TreeItem>) -> bool {
let mut par = opt.clone();
loop {
match par.as_ref().unwrap().parent() {
Some(p) => {
if p.is_close() {
return false;
} else {
par = Some(p.clone());
}
}
None => return true,
}
}
}
sourcepub fn set_parent(&mut self, val: &TreeItem)
pub fn set_parent(&mut self, val: &TreeItem)
Set the parent of the item
sourcepub fn is_close(&self) -> bool
pub fn is_close(&self) -> bool
Returns whether an item is closed
Examples found in repository?
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
fn verify_open_till_root(opt: &Option<fltk::tree::TreeItem>) -> bool {
let mut par = opt.clone();
loop {
match par.as_ref().unwrap().parent() {
Some(p) => {
if p.is_close() {
return false;
} else {
par = Some(p.clone());
}
}
None => return true,
}
}
}
sourcepub fn open_toggle(&mut self)
pub fn open_toggle(&mut self)
Toggle the open state of the item
sourcepub fn select_toggle(&mut self)
pub fn select_toggle(&mut self)
Toggle the select state of an item
sourcepub fn select_all(&mut self) -> i32
pub fn select_all(&mut self) -> i32
Select all subitems, returns number of selected items
sourcepub fn deselect_all(&mut self) -> i32
pub fn deselect_all(&mut self) -> i32
Deselect all subitems
sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns whether an item is visible
sourcepub fn is_activated(&self) -> bool
pub fn is_activated(&self) -> bool
Returns whether an item is activated
sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate an item
sourcepub fn is_selected(&self) -> bool
pub fn is_selected(&self) -> bool
Returns whether an item is selected
sourcepub fn was_deleted(&self) -> bool
pub fn was_deleted(&self) -> bool
Check if the tree item was deleted
sourcepub fn set_user_icon<Img: ImageExt>(&mut self, image: Option<Img>)
pub fn set_user_icon<Img: ImageExt>(&mut self, image: Option<Img>)
Sets the user icon
sourcepub fn as_ptr(&self) -> *mut Fl_Tree_Item
pub fn as_ptr(&self) -> *mut Fl_Tree_Item
Return the internal pointer of the tree item
Trait Implementations§
source§impl Iterator for TreeItem
impl Iterator for TreeItem
source§fn next_chunk<const N: usize>(
&mut self
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read more1.0.0 · source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
1.0.0 · source§fn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
1.0.0 · source§fn last(self) -> Option<Self::Item>where
Self: Sized,
fn last(self) -> Option<Self::Item>where
Self: Sized,
source§fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
iter_advance_by
)n
elements. Read more1.0.0 · source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
)separator
between adjacent
items of the original iterator. Read moresource§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 · source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
)1.0.0 · source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 · source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
source§fn try_reduce<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<F, R>( &mut self, f: F ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
)1.0.0 · source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 · source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 · source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
source§fn try_find<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<F, R>( &mut self, f: F ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
)1.0.0 · source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.6.0 · source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 · source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read more1.11.0 · source§fn product<P>(self) -> P
fn product<P>(self) -> P
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of
this Iterator
with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moresource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
)1.5.0 · source§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read more1.5.0 · source§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 · source§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read more1.5.0 · source§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read moresource§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
is_sorted
)source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
is_sorted
)source§impl PartialEq for TreeItem
impl PartialEq for TreeItem
impl Eq for TreeItem
impl Send for TreeItem
single-threaded
only.impl Sync for TreeItem
single-threaded
only.