Struct RowManager

Source
pub struct RowManager { /* private fields */ }
Expand description

RowManager allows to store and update many progress bars.

nrows is the number of progress bars to display at once. All other bars are hidden and visible once any active progress bar is completed. Traces of progress are left in terminal if leave is true else progress bar is cleared.

§Note

Cursor positions are not restored by RowManager.

§Example

use kdam::{tqdm, BarExt, RowManager};

let mut manager = RowManager::new(3);
let pb_index = manager.push(tqdm!(total = 100)).unwrap();

for _ in 0..100 {
    manager.get_mut(pb_index).unwrap().update(1).unwrap();
    manager.notify(pb_index).unwrap();
}

manager.remove(pb_index);

Implementations§

Source§

impl RowManager

Source

pub fn new(nrows: u16) -> Self

Create a new RowManager with specified number of rows.

§Example
use kdam::RowManager;

// Display 3 progress bars at once.
let manager = RowManager::new(3);
Examples found in repository?
examples/multiple/row_manager_keep.rs (line 13)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            desc = format!("BAR {}", i),
19            force_refresh = true
20        ))?;
21    }
22
23    let manager = Arc::new(Mutex::new(manager));
24
25    let manager1 = manager.clone();
26    let thread1 = thread::spawn(move || {
27        for _ in 0..150 {
28            thread::sleep(Duration::from_secs_f32(0.02));
29            let mut manager = manager1.lock().unwrap();
30            manager.get_mut(0).unwrap().update(1).unwrap();
31            manager.notify(0).unwrap();
32        }
33    });
34
35    let manager2 = manager.clone();
36    let thread2 = thread::spawn(move || {
37        for _ in 0..100 {
38            thread::sleep(Duration::from_secs_f32(0.02));
39            let mut manager = manager2.lock().unwrap();
40            manager.get_mut(1).unwrap().update(1).unwrap();
41            manager.notify(1).unwrap();
42        }
43    });
44
45    let manager3 = manager.clone();
46    let thread3 = thread::spawn(move || {
47        for _ in 0..200 {
48            thread::sleep(Duration::from_secs_f32(0.02));
49            let mut manager = manager3.lock().unwrap();
50            manager.get_mut(2).unwrap().update(1).unwrap();
51            manager.notify(2).unwrap();
52        }
53    });
54
55    let manager4 = manager.clone();
56    let thread4 = thread::spawn(move || {
57        for _ in 0..400 {
58            thread::sleep(Duration::from_secs_f32(0.02));
59            let mut manager = manager4.lock().unwrap();
60            manager.get_mut(3).unwrap().update(1).unwrap();
61            manager.notify(3).unwrap();
62        }
63    });
64
65    let manager5 = manager.clone();
66    let thread5 = thread::spawn(move || {
67        for _ in 0..500 {
68            thread::sleep(Duration::from_secs_f32(0.02));
69            let mut manager = manager5.lock().unwrap();
70            manager.get_mut(4).unwrap().update(1).unwrap();
71            manager.notify(4).unwrap();
72        }
73    });
74
75    let manager6 = manager;
76    let thread6 = thread::spawn(move || {
77        for _ in 0..600 {
78            thread::sleep(Duration::from_secs_f32(0.02));
79            let mut manager = manager6.lock().unwrap();
80            manager.get_mut(5).unwrap().update(1).unwrap();
81            manager.notify(5).unwrap();
82        }
83    });
84
85    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
86        thread.join().unwrap();
87    }
88
89    println!("\rcompleted!");
90    Ok(())
91}
More examples
Hide additional examples
examples/multiple/row_manager_clean.rs (line 13)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            leave = false,
19            desc = format!("BAR {}", i),
20            force_refresh = true
21        ))?;
22    }
23
24    let manager = Arc::new(Mutex::new(manager));
25
26    let manager1 = manager.clone();
27    let thread1 = thread::spawn(move || {
28        for _ in 0..150 {
29            thread::sleep(Duration::from_secs_f32(0.02));
30            let mut manager = manager1.lock().unwrap();
31            manager.get_mut(0).unwrap().update(1).unwrap();
32            manager.notify(0).unwrap();
33        }
34    });
35
36    let manager2 = manager.clone();
37    let thread2 = thread::spawn(move || {
38        for _ in 0..100 {
39            thread::sleep(Duration::from_secs_f32(0.02));
40            let mut manager = manager2.lock().unwrap();
41            manager.get_mut(1).unwrap().update(1).unwrap();
42            manager.notify(1).unwrap();
43        }
44    });
45
46    let manager3 = manager.clone();
47    let thread3 = thread::spawn(move || {
48        for _ in 0..200 {
49            thread::sleep(Duration::from_secs_f32(0.02));
50            let mut manager = manager3.lock().unwrap();
51            manager.get_mut(2).unwrap().update(1).unwrap();
52            manager.notify(2).unwrap();
53        }
54    });
55
56    let manager4 = manager.clone();
57    let thread4 = thread::spawn(move || {
58        for _ in 0..400 {
59            thread::sleep(Duration::from_secs_f32(0.02));
60            let mut manager = manager4.lock().unwrap();
61            manager.get_mut(3).unwrap().update(1).unwrap();
62            manager.notify(3).unwrap();
63        }
64    });
65
66    let manager5 = manager.clone();
67    let thread5 = thread::spawn(move || {
68        for _ in 0..500 {
69            thread::sleep(Duration::from_secs_f32(0.02));
70            let mut manager = manager5.lock().unwrap();
71            manager.get_mut(4).unwrap().update(1).unwrap();
72            manager.notify(4).unwrap();
73        }
74    });
75
76    let manager6 = manager;
77    let thread6 = thread::spawn(move || {
78        for _ in 0..600 {
79            thread::sleep(Duration::from_secs_f32(0.02));
80            let mut manager = manager6.lock().unwrap();
81            manager.get_mut(5).unwrap().update(1).unwrap();
82            manager.notify(5).unwrap();
83        }
84    });
85
86    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
87        thread.join().unwrap();
88    }
89
90    println!("\rcompleted!");
91    Ok(())
92}
Source

pub fn from_window_size() -> Self

Create a new RowManager from terminal window size.

§Example
use kdam::RowManager;

let mut manager = RowManager::from_window_size();
Source

pub fn push(&mut self, pb: Bar) -> Result<usize>

Push a progress bar returning back it’s index.

Examples found in repository?
examples/multiple/row_manager_keep.rs (lines 16-20)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            desc = format!("BAR {}", i),
19            force_refresh = true
20        ))?;
21    }
22
23    let manager = Arc::new(Mutex::new(manager));
24
25    let manager1 = manager.clone();
26    let thread1 = thread::spawn(move || {
27        for _ in 0..150 {
28            thread::sleep(Duration::from_secs_f32(0.02));
29            let mut manager = manager1.lock().unwrap();
30            manager.get_mut(0).unwrap().update(1).unwrap();
31            manager.notify(0).unwrap();
32        }
33    });
34
35    let manager2 = manager.clone();
36    let thread2 = thread::spawn(move || {
37        for _ in 0..100 {
38            thread::sleep(Duration::from_secs_f32(0.02));
39            let mut manager = manager2.lock().unwrap();
40            manager.get_mut(1).unwrap().update(1).unwrap();
41            manager.notify(1).unwrap();
42        }
43    });
44
45    let manager3 = manager.clone();
46    let thread3 = thread::spawn(move || {
47        for _ in 0..200 {
48            thread::sleep(Duration::from_secs_f32(0.02));
49            let mut manager = manager3.lock().unwrap();
50            manager.get_mut(2).unwrap().update(1).unwrap();
51            manager.notify(2).unwrap();
52        }
53    });
54
55    let manager4 = manager.clone();
56    let thread4 = thread::spawn(move || {
57        for _ in 0..400 {
58            thread::sleep(Duration::from_secs_f32(0.02));
59            let mut manager = manager4.lock().unwrap();
60            manager.get_mut(3).unwrap().update(1).unwrap();
61            manager.notify(3).unwrap();
62        }
63    });
64
65    let manager5 = manager.clone();
66    let thread5 = thread::spawn(move || {
67        for _ in 0..500 {
68            thread::sleep(Duration::from_secs_f32(0.02));
69            let mut manager = manager5.lock().unwrap();
70            manager.get_mut(4).unwrap().update(1).unwrap();
71            manager.notify(4).unwrap();
72        }
73    });
74
75    let manager6 = manager;
76    let thread6 = thread::spawn(move || {
77        for _ in 0..600 {
78            thread::sleep(Duration::from_secs_f32(0.02));
79            let mut manager = manager6.lock().unwrap();
80            manager.get_mut(5).unwrap().update(1).unwrap();
81            manager.notify(5).unwrap();
82        }
83    });
84
85    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
86        thread.join().unwrap();
87    }
88
89    println!("\rcompleted!");
90    Ok(())
91}
More examples
Hide additional examples
examples/multiple/row_manager_clean.rs (lines 16-21)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            leave = false,
19            desc = format!("BAR {}", i),
20            force_refresh = true
21        ))?;
22    }
23
24    let manager = Arc::new(Mutex::new(manager));
25
26    let manager1 = manager.clone();
27    let thread1 = thread::spawn(move || {
28        for _ in 0..150 {
29            thread::sleep(Duration::from_secs_f32(0.02));
30            let mut manager = manager1.lock().unwrap();
31            manager.get_mut(0).unwrap().update(1).unwrap();
32            manager.notify(0).unwrap();
33        }
34    });
35
36    let manager2 = manager.clone();
37    let thread2 = thread::spawn(move || {
38        for _ in 0..100 {
39            thread::sleep(Duration::from_secs_f32(0.02));
40            let mut manager = manager2.lock().unwrap();
41            manager.get_mut(1).unwrap().update(1).unwrap();
42            manager.notify(1).unwrap();
43        }
44    });
45
46    let manager3 = manager.clone();
47    let thread3 = thread::spawn(move || {
48        for _ in 0..200 {
49            thread::sleep(Duration::from_secs_f32(0.02));
50            let mut manager = manager3.lock().unwrap();
51            manager.get_mut(2).unwrap().update(1).unwrap();
52            manager.notify(2).unwrap();
53        }
54    });
55
56    let manager4 = manager.clone();
57    let thread4 = thread::spawn(move || {
58        for _ in 0..400 {
59            thread::sleep(Duration::from_secs_f32(0.02));
60            let mut manager = manager4.lock().unwrap();
61            manager.get_mut(3).unwrap().update(1).unwrap();
62            manager.notify(3).unwrap();
63        }
64    });
65
66    let manager5 = manager.clone();
67    let thread5 = thread::spawn(move || {
68        for _ in 0..500 {
69            thread::sleep(Duration::from_secs_f32(0.02));
70            let mut manager = manager5.lock().unwrap();
71            manager.get_mut(4).unwrap().update(1).unwrap();
72            manager.notify(4).unwrap();
73        }
74    });
75
76    let manager6 = manager;
77    let thread6 = thread::spawn(move || {
78        for _ in 0..600 {
79            thread::sleep(Duration::from_secs_f32(0.02));
80            let mut manager = manager6.lock().unwrap();
81            manager.get_mut(5).unwrap().update(1).unwrap();
82            manager.notify(5).unwrap();
83        }
84    });
85
86    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
87        thread.join().unwrap();
88    }
89
90    println!("\rcompleted!");
91    Ok(())
92}
Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut Bar>

Returns a mutable reference to progress bar.

Examples found in repository?
examples/multiple/row_manager_keep.rs (line 30)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            desc = format!("BAR {}", i),
19            force_refresh = true
20        ))?;
21    }
22
23    let manager = Arc::new(Mutex::new(manager));
24
25    let manager1 = manager.clone();
26    let thread1 = thread::spawn(move || {
27        for _ in 0..150 {
28            thread::sleep(Duration::from_secs_f32(0.02));
29            let mut manager = manager1.lock().unwrap();
30            manager.get_mut(0).unwrap().update(1).unwrap();
31            manager.notify(0).unwrap();
32        }
33    });
34
35    let manager2 = manager.clone();
36    let thread2 = thread::spawn(move || {
37        for _ in 0..100 {
38            thread::sleep(Duration::from_secs_f32(0.02));
39            let mut manager = manager2.lock().unwrap();
40            manager.get_mut(1).unwrap().update(1).unwrap();
41            manager.notify(1).unwrap();
42        }
43    });
44
45    let manager3 = manager.clone();
46    let thread3 = thread::spawn(move || {
47        for _ in 0..200 {
48            thread::sleep(Duration::from_secs_f32(0.02));
49            let mut manager = manager3.lock().unwrap();
50            manager.get_mut(2).unwrap().update(1).unwrap();
51            manager.notify(2).unwrap();
52        }
53    });
54
55    let manager4 = manager.clone();
56    let thread4 = thread::spawn(move || {
57        for _ in 0..400 {
58            thread::sleep(Duration::from_secs_f32(0.02));
59            let mut manager = manager4.lock().unwrap();
60            manager.get_mut(3).unwrap().update(1).unwrap();
61            manager.notify(3).unwrap();
62        }
63    });
64
65    let manager5 = manager.clone();
66    let thread5 = thread::spawn(move || {
67        for _ in 0..500 {
68            thread::sleep(Duration::from_secs_f32(0.02));
69            let mut manager = manager5.lock().unwrap();
70            manager.get_mut(4).unwrap().update(1).unwrap();
71            manager.notify(4).unwrap();
72        }
73    });
74
75    let manager6 = manager;
76    let thread6 = thread::spawn(move || {
77        for _ in 0..600 {
78            thread::sleep(Duration::from_secs_f32(0.02));
79            let mut manager = manager6.lock().unwrap();
80            manager.get_mut(5).unwrap().update(1).unwrap();
81            manager.notify(5).unwrap();
82        }
83    });
84
85    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
86        thread.join().unwrap();
87    }
88
89    println!("\rcompleted!");
90    Ok(())
91}
More examples
Hide additional examples
examples/multiple/row_manager_clean.rs (line 31)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            leave = false,
19            desc = format!("BAR {}", i),
20            force_refresh = true
21        ))?;
22    }
23
24    let manager = Arc::new(Mutex::new(manager));
25
26    let manager1 = manager.clone();
27    let thread1 = thread::spawn(move || {
28        for _ in 0..150 {
29            thread::sleep(Duration::from_secs_f32(0.02));
30            let mut manager = manager1.lock().unwrap();
31            manager.get_mut(0).unwrap().update(1).unwrap();
32            manager.notify(0).unwrap();
33        }
34    });
35
36    let manager2 = manager.clone();
37    let thread2 = thread::spawn(move || {
38        for _ in 0..100 {
39            thread::sleep(Duration::from_secs_f32(0.02));
40            let mut manager = manager2.lock().unwrap();
41            manager.get_mut(1).unwrap().update(1).unwrap();
42            manager.notify(1).unwrap();
43        }
44    });
45
46    let manager3 = manager.clone();
47    let thread3 = thread::spawn(move || {
48        for _ in 0..200 {
49            thread::sleep(Duration::from_secs_f32(0.02));
50            let mut manager = manager3.lock().unwrap();
51            manager.get_mut(2).unwrap().update(1).unwrap();
52            manager.notify(2).unwrap();
53        }
54    });
55
56    let manager4 = manager.clone();
57    let thread4 = thread::spawn(move || {
58        for _ in 0..400 {
59            thread::sleep(Duration::from_secs_f32(0.02));
60            let mut manager = manager4.lock().unwrap();
61            manager.get_mut(3).unwrap().update(1).unwrap();
62            manager.notify(3).unwrap();
63        }
64    });
65
66    let manager5 = manager.clone();
67    let thread5 = thread::spawn(move || {
68        for _ in 0..500 {
69            thread::sleep(Duration::from_secs_f32(0.02));
70            let mut manager = manager5.lock().unwrap();
71            manager.get_mut(4).unwrap().update(1).unwrap();
72            manager.notify(4).unwrap();
73        }
74    });
75
76    let manager6 = manager;
77    let thread6 = thread::spawn(move || {
78        for _ in 0..600 {
79            thread::sleep(Duration::from_secs_f32(0.02));
80            let mut manager = manager6.lock().unwrap();
81            manager.get_mut(5).unwrap().update(1).unwrap();
82            manager.notify(5).unwrap();
83        }
84    });
85
86    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
87        thread.join().unwrap();
88    }
89
90    println!("\rcompleted!");
91    Ok(())
92}
Source

pub fn notify(&mut self, index: usize) -> Result<()>

Update and print the required stuff for progress bar at that index.

§Panics

If index is out of bounds.

Examples found in repository?
examples/multiple/row_manager_keep.rs (line 31)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            desc = format!("BAR {}", i),
19            force_refresh = true
20        ))?;
21    }
22
23    let manager = Arc::new(Mutex::new(manager));
24
25    let manager1 = manager.clone();
26    let thread1 = thread::spawn(move || {
27        for _ in 0..150 {
28            thread::sleep(Duration::from_secs_f32(0.02));
29            let mut manager = manager1.lock().unwrap();
30            manager.get_mut(0).unwrap().update(1).unwrap();
31            manager.notify(0).unwrap();
32        }
33    });
34
35    let manager2 = manager.clone();
36    let thread2 = thread::spawn(move || {
37        for _ in 0..100 {
38            thread::sleep(Duration::from_secs_f32(0.02));
39            let mut manager = manager2.lock().unwrap();
40            manager.get_mut(1).unwrap().update(1).unwrap();
41            manager.notify(1).unwrap();
42        }
43    });
44
45    let manager3 = manager.clone();
46    let thread3 = thread::spawn(move || {
47        for _ in 0..200 {
48            thread::sleep(Duration::from_secs_f32(0.02));
49            let mut manager = manager3.lock().unwrap();
50            manager.get_mut(2).unwrap().update(1).unwrap();
51            manager.notify(2).unwrap();
52        }
53    });
54
55    let manager4 = manager.clone();
56    let thread4 = thread::spawn(move || {
57        for _ in 0..400 {
58            thread::sleep(Duration::from_secs_f32(0.02));
59            let mut manager = manager4.lock().unwrap();
60            manager.get_mut(3).unwrap().update(1).unwrap();
61            manager.notify(3).unwrap();
62        }
63    });
64
65    let manager5 = manager.clone();
66    let thread5 = thread::spawn(move || {
67        for _ in 0..500 {
68            thread::sleep(Duration::from_secs_f32(0.02));
69            let mut manager = manager5.lock().unwrap();
70            manager.get_mut(4).unwrap().update(1).unwrap();
71            manager.notify(4).unwrap();
72        }
73    });
74
75    let manager6 = manager;
76    let thread6 = thread::spawn(move || {
77        for _ in 0..600 {
78            thread::sleep(Duration::from_secs_f32(0.02));
79            let mut manager = manager6.lock().unwrap();
80            manager.get_mut(5).unwrap().update(1).unwrap();
81            manager.notify(5).unwrap();
82        }
83    });
84
85    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
86        thread.join().unwrap();
87    }
88
89    println!("\rcompleted!");
90    Ok(())
91}
More examples
Hide additional examples
examples/multiple/row_manager_clean.rs (line 32)
9fn main() -> Result<()> {
10    term::init(false);
11    term::hide_cursor()?;
12
13    let mut manager = RowManager::new(3);
14
15    for (i, total) in [150, 100, 200, 400, 500, 600].iter().enumerate() {
16        manager.push(tqdm!(
17            total = *total,
18            leave = false,
19            desc = format!("BAR {}", i),
20            force_refresh = true
21        ))?;
22    }
23
24    let manager = Arc::new(Mutex::new(manager));
25
26    let manager1 = manager.clone();
27    let thread1 = thread::spawn(move || {
28        for _ in 0..150 {
29            thread::sleep(Duration::from_secs_f32(0.02));
30            let mut manager = manager1.lock().unwrap();
31            manager.get_mut(0).unwrap().update(1).unwrap();
32            manager.notify(0).unwrap();
33        }
34    });
35
36    let manager2 = manager.clone();
37    let thread2 = thread::spawn(move || {
38        for _ in 0..100 {
39            thread::sleep(Duration::from_secs_f32(0.02));
40            let mut manager = manager2.lock().unwrap();
41            manager.get_mut(1).unwrap().update(1).unwrap();
42            manager.notify(1).unwrap();
43        }
44    });
45
46    let manager3 = manager.clone();
47    let thread3 = thread::spawn(move || {
48        for _ in 0..200 {
49            thread::sleep(Duration::from_secs_f32(0.02));
50            let mut manager = manager3.lock().unwrap();
51            manager.get_mut(2).unwrap().update(1).unwrap();
52            manager.notify(2).unwrap();
53        }
54    });
55
56    let manager4 = manager.clone();
57    let thread4 = thread::spawn(move || {
58        for _ in 0..400 {
59            thread::sleep(Duration::from_secs_f32(0.02));
60            let mut manager = manager4.lock().unwrap();
61            manager.get_mut(3).unwrap().update(1).unwrap();
62            manager.notify(3).unwrap();
63        }
64    });
65
66    let manager5 = manager.clone();
67    let thread5 = thread::spawn(move || {
68        for _ in 0..500 {
69            thread::sleep(Duration::from_secs_f32(0.02));
70            let mut manager = manager5.lock().unwrap();
71            manager.get_mut(4).unwrap().update(1).unwrap();
72            manager.notify(4).unwrap();
73        }
74    });
75
76    let manager6 = manager;
77    let thread6 = thread::spawn(move || {
78        for _ in 0..600 {
79            thread::sleep(Duration::from_secs_f32(0.02));
80            let mut manager = manager6.lock().unwrap();
81            manager.get_mut(5).unwrap().update(1).unwrap();
82            manager.notify(5).unwrap();
83        }
84    });
85
86    for thread in [thread1, thread2, thread3, thread4, thread5, thread6] {
87        thread.join().unwrap();
88    }
89
90    println!("\rcompleted!");
91    Ok(())
92}
Source

pub fn remove(&mut self, index: usize) -> Bar

Removes a progress bar and returns it.

§Panics

If index is out of bounds.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,