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_text_boxed(&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 fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
46 let mut t_widget = Tree::new(x, y, width, height, title);
47 let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
48 let pfr = Rc::clone(&previous_focus);
49 t_widget.set_callback_reason(TreeReason::Selected);
50 t_widget.set_callback(|_t| println!("clicked an item"));
51 t_widget.handle(move |t, e| match e {
52 Event::Move => {
53 let (_, mouse_y) = app::event_coords();
54 let mut state = State::Undefined;
55 let mut pf = pfr.borrow_mut();
56 loop {
57 match &*pf {
58 Some(item) => {
59 let item_y = item.y();
60 match state {
61 State::MovingUp => {
62 if verify_open_till_root(&pf) {
63 if mouse_y < item_y {
64 *pf = pf.as_ref().unwrap().prev();
65 continue;
66 };
67 break;
68 } else {
69 *pf = pf.as_ref().unwrap().prev();
70 continue;
71 }
72 }
73 State::MovingDown => {
74 if verify_open_till_root(&pf) {
75 if mouse_y > item_y + item.h() {
76 *pf = pf.as_ref().unwrap().next();
77 continue;
78 };
79 break;
80 } else {
81 *pf = pf.as_ref().unwrap().next();
82 continue;
83 }
84 }
85 State::Undefined => {
86 if mouse_y < item_y {
87 *pf = pf.as_ref().unwrap().prev();
88 state = State::MovingUp;
89 continue;
90 };
91 if mouse_y > item_y + item.h() {
92 *pf = pf.as_ref().unwrap().next();
93 state = State::MovingDown;
94 continue;
95 };
96 return true; // If in same range, don't update 'previous_focus'
97 }
98 }
99 }
100 // End up here if y is outside tree boundaries, or no tree item is present
101 None => match &state {
102 State::MovingUp | State::MovingDown => return true,
103 State::Undefined => {
104 *pf = t.first();
105 state = State::MovingDown;
106 if pf.is_none() {
107 return true;
108 }
109 continue;
110 }
111 },
112 };
113 }
114 if verify_open_till_root(&pf) {
115 t.take_focus().ok();
116 t.set_item_focus(pf.as_ref().unwrap());
117 println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
118 }
119 true
120 }
121 _ => false,
122 });
123 Self {
124 t_widget,
125 previous_focus,
126 }
127 }
Sourcepub fn h(&self) -> i32
pub fn h(&self) -> i32
Gets the height
Examples found in repository?
45 fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
46 let mut t_widget = Tree::new(x, y, width, height, title);
47 let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
48 let pfr = Rc::clone(&previous_focus);
49 t_widget.set_callback_reason(TreeReason::Selected);
50 t_widget.set_callback(|_t| println!("clicked an item"));
51 t_widget.handle(move |t, e| match e {
52 Event::Move => {
53 let (_, mouse_y) = app::event_coords();
54 let mut state = State::Undefined;
55 let mut pf = pfr.borrow_mut();
56 loop {
57 match &*pf {
58 Some(item) => {
59 let item_y = item.y();
60 match state {
61 State::MovingUp => {
62 if verify_open_till_root(&pf) {
63 if mouse_y < item_y {
64 *pf = pf.as_ref().unwrap().prev();
65 continue;
66 };
67 break;
68 } else {
69 *pf = pf.as_ref().unwrap().prev();
70 continue;
71 }
72 }
73 State::MovingDown => {
74 if verify_open_till_root(&pf) {
75 if mouse_y > item_y + item.h() {
76 *pf = pf.as_ref().unwrap().next();
77 continue;
78 };
79 break;
80 } else {
81 *pf = pf.as_ref().unwrap().next();
82 continue;
83 }
84 }
85 State::Undefined => {
86 if mouse_y < item_y {
87 *pf = pf.as_ref().unwrap().prev();
88 state = State::MovingUp;
89 continue;
90 };
91 if mouse_y > item_y + item.h() {
92 *pf = pf.as_ref().unwrap().next();
93 state = State::MovingDown;
94 continue;
95 };
96 return true; // If in same range, don't update 'previous_focus'
97 }
98 }
99 }
100 // End up here if y is outside tree boundaries, or no tree item is present
101 None => match &state {
102 State::MovingUp | State::MovingDown => return true,
103 State::Undefined => {
104 *pf = t.first();
105 state = State::MovingDown;
106 if pf.is_none() {
107 return true;
108 }
109 continue;
110 }
111 },
112 };
113 }
114 if verify_open_till_root(&pf) {
115 t.take_focus().ok();
116 t.set_item_focus(pf.as_ref().unwrap());
117 println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
118 }
119 true
120 }
121 _ => false,
122 });
123 Self {
124 t_widget,
125 previous_focus,
126 }
127 }
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?
146fn main() {
147 let path = env::current_dir().unwrap();
148 let path: String = path
149 .to_str()
150 .unwrap()
151 .chars()
152 .map(|c| match c {
153 '\\' => '/', // change window paths to posix paths
154 _ => c,
155 })
156 .collect();
157
158 let app = app::App::default().with_scheme(app::Scheme::Gtk);
159 let mut wind = Window::default().with_size(400, 300);
160 let mut but = Button::new(260, 255, 80, 40, "Get Items");
161 let _frame = Frame::new(20, 255, 160, 40, "Focus follow mouse");
162 let mut tree = TreeMouseFocus::new(5, 10, 190, 240, "");
163 tree.add(&path);
164
165 let mut items = tree.get_items().unwrap();
166 items.as_mut_slice()[0].set_label("/");
167
168 let mut tree2 = Tree::new(205, 10, 190, 240, "");
169 tree2.set_select_mode(TreeSelect::Multi);
170 tree2.add("First");
171 tree2.add("First/1st");
172 tree2.add("First/2nd/3rd");
173 tree2.add("Second");
174 tree2.add("Third");
175
176 tree2.set_when(fltk::enums::When::ReleaseAlways);
177
178 wind.make_resizable(true);
179 wind.show();
180
181 but.set_callback({
182 let tree2 = tree2.clone();
183 move |_| match tree2.get_selected_items() {
184 None => println!("No items selected"),
185 Some(vals) => print!(
186 "In total {} items selected:\n{}",
187 vals.len(),
188 vals.iter()
189 .map(|i| tree2.item_pathname(i).unwrap() + "\n")
190 .collect::<String>()
191 ),
192 }
193 });
194
195 app.run().unwrap();
196}
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Gets the label of the tree item
Examples found in repository?
45 fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
46 let mut t_widget = Tree::new(x, y, width, height, title);
47 let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
48 let pfr = Rc::clone(&previous_focus);
49 t_widget.set_callback_reason(TreeReason::Selected);
50 t_widget.set_callback(|_t| println!("clicked an item"));
51 t_widget.handle(move |t, e| match e {
52 Event::Move => {
53 let (_, mouse_y) = app::event_coords();
54 let mut state = State::Undefined;
55 let mut pf = pfr.borrow_mut();
56 loop {
57 match &*pf {
58 Some(item) => {
59 let item_y = item.y();
60 match state {
61 State::MovingUp => {
62 if verify_open_till_root(&pf) {
63 if mouse_y < item_y {
64 *pf = pf.as_ref().unwrap().prev();
65 continue;
66 };
67 break;
68 } else {
69 *pf = pf.as_ref().unwrap().prev();
70 continue;
71 }
72 }
73 State::MovingDown => {
74 if verify_open_till_root(&pf) {
75 if mouse_y > item_y + item.h() {
76 *pf = pf.as_ref().unwrap().next();
77 continue;
78 };
79 break;
80 } else {
81 *pf = pf.as_ref().unwrap().next();
82 continue;
83 }
84 }
85 State::Undefined => {
86 if mouse_y < item_y {
87 *pf = pf.as_ref().unwrap().prev();
88 state = State::MovingUp;
89 continue;
90 };
91 if mouse_y > item_y + item.h() {
92 *pf = pf.as_ref().unwrap().next();
93 state = State::MovingDown;
94 continue;
95 };
96 return true; // If in same range, don't update 'previous_focus'
97 }
98 }
99 }
100 // End up here if y is outside tree boundaries, or no tree item is present
101 None => match &state {
102 State::MovingUp | State::MovingDown => return true,
103 State::Undefined => {
104 *pf = t.first();
105 state = State::MovingDown;
106 if pf.is_none() {
107 return true;
108 }
109 continue;
110 }
111 },
112 };
113 }
114 if verify_open_till_root(&pf) {
115 t.take_focus().ok();
116 t.set_item_focus(pf.as_ref().unwrap());
117 println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
118 }
119 true
120 }
121 _ => false,
122 });
123 Self {
124 t_widget,
125 previous_focus,
126 }
127 }
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_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 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 fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
46 let mut t_widget = Tree::new(x, y, width, height, title);
47 let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
48 let pfr = Rc::clone(&previous_focus);
49 t_widget.set_callback_reason(TreeReason::Selected);
50 t_widget.set_callback(|_t| println!("clicked an item"));
51 t_widget.handle(move |t, e| match e {
52 Event::Move => {
53 let (_, mouse_y) = app::event_coords();
54 let mut state = State::Undefined;
55 let mut pf = pfr.borrow_mut();
56 loop {
57 match &*pf {
58 Some(item) => {
59 let item_y = item.y();
60 match state {
61 State::MovingUp => {
62 if verify_open_till_root(&pf) {
63 if mouse_y < item_y {
64 *pf = pf.as_ref().unwrap().prev();
65 continue;
66 };
67 break;
68 } else {
69 *pf = pf.as_ref().unwrap().prev();
70 continue;
71 }
72 }
73 State::MovingDown => {
74 if verify_open_till_root(&pf) {
75 if mouse_y > item_y + item.h() {
76 *pf = pf.as_ref().unwrap().next();
77 continue;
78 };
79 break;
80 } else {
81 *pf = pf.as_ref().unwrap().next();
82 continue;
83 }
84 }
85 State::Undefined => {
86 if mouse_y < item_y {
87 *pf = pf.as_ref().unwrap().prev();
88 state = State::MovingUp;
89 continue;
90 };
91 if mouse_y > item_y + item.h() {
92 *pf = pf.as_ref().unwrap().next();
93 state = State::MovingDown;
94 continue;
95 };
96 return true; // If in same range, don't update 'previous_focus'
97 }
98 }
99 }
100 // End up here if y is outside tree boundaries, or no tree item is present
101 None => match &state {
102 State::MovingUp | State::MovingDown => return true,
103 State::Undefined => {
104 *pf = t.first();
105 state = State::MovingDown;
106 if pf.is_none() {
107 return true;
108 }
109 continue;
110 }
111 },
112 };
113 }
114 if verify_open_till_root(&pf) {
115 t.take_focus().ok();
116 t.set_item_focus(pf.as_ref().unwrap());
117 println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
118 }
119 true
120 }
121 _ => false,
122 });
123 Self {
124 t_widget,
125 previous_focus,
126 }
127 }
Sourcepub fn next(&self) -> Option<TreeItem>
pub fn next(&self) -> Option<TreeItem>
Gets the next item
Examples found in repository?
45 fn new(x: i32, y: i32, width: i32, height: i32, title: &'static str) -> Self {
46 let mut t_widget = Tree::new(x, y, width, height, title);
47 let previous_focus = Rc::new(RefCell::new(None::<TreeItem>));
48 let pfr = Rc::clone(&previous_focus);
49 t_widget.set_callback_reason(TreeReason::Selected);
50 t_widget.set_callback(|_t| println!("clicked an item"));
51 t_widget.handle(move |t, e| match e {
52 Event::Move => {
53 let (_, mouse_y) = app::event_coords();
54 let mut state = State::Undefined;
55 let mut pf = pfr.borrow_mut();
56 loop {
57 match &*pf {
58 Some(item) => {
59 let item_y = item.y();
60 match state {
61 State::MovingUp => {
62 if verify_open_till_root(&pf) {
63 if mouse_y < item_y {
64 *pf = pf.as_ref().unwrap().prev();
65 continue;
66 };
67 break;
68 } else {
69 *pf = pf.as_ref().unwrap().prev();
70 continue;
71 }
72 }
73 State::MovingDown => {
74 if verify_open_till_root(&pf) {
75 if mouse_y > item_y + item.h() {
76 *pf = pf.as_ref().unwrap().next();
77 continue;
78 };
79 break;
80 } else {
81 *pf = pf.as_ref().unwrap().next();
82 continue;
83 }
84 }
85 State::Undefined => {
86 if mouse_y < item_y {
87 *pf = pf.as_ref().unwrap().prev();
88 state = State::MovingUp;
89 continue;
90 };
91 if mouse_y > item_y + item.h() {
92 *pf = pf.as_ref().unwrap().next();
93 state = State::MovingDown;
94 continue;
95 };
96 return true; // If in same range, don't update 'previous_focus'
97 }
98 }
99 }
100 // End up here if y is outside tree boundaries, or no tree item is present
101 None => match &state {
102 State::MovingUp | State::MovingDown => return true,
103 State::Undefined => {
104 *pf = t.first();
105 state = State::MovingDown;
106 if pf.is_none() {
107 return true;
108 }
109 continue;
110 }
111 },
112 };
113 }
114 if verify_open_till_root(&pf) {
115 t.take_focus().ok();
116 t.set_item_focus(pf.as_ref().unwrap());
117 println!("Set focus to item: {:?}", pf.as_ref().unwrap().label());
118 }
119 true
120 }
121 _ => false,
122 });
123 Self {
124 t_widget,
125 previous_focus,
126 }
127 }
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?
23fn verify_open_till_root(opt: &Option<fltk::tree::TreeItem>) -> bool {
24 let mut par = opt.clone();
25 loop {
26 match par.as_ref().unwrap().parent() {
27 Some(p) => {
28 if p.is_close() {
29 return false;
30 } else {
31 par = Some(p.clone());
32 }
33 }
34 None => return true,
35 }
36 }
37}
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?
23fn verify_open_till_root(opt: &Option<fltk::tree::TreeItem>) -> bool {
24 let mut par = opt.clone();
25 loop {
26 match par.as_ref().unwrap().parent() {
27 Some(p) => {
28 if p.is_close() {
29 return false;
30 } else {
31 par = Some(p.clone());
32 }
33 }
34 None => return true,
35 }
36 }
37}
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<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
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,
Iterator
. Read moreSource§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<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<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<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<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 more1.82.0 · Source§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 · Source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl Eq for TreeItem
impl Send for TreeItem
single-threaded
only.impl Sync for TreeItem
single-threaded
only.