pub struct Tui {
pub terminal: Terminal<CrosstermBackend<IO>>,
pub task: JoinHandle<()>,
pub cancellation_token: CancellationToken,
pub event_rx: UnboundedReceiver<Event>,
pub event_tx: UnboundedSender<Event>,
pub frame_rate: f64,
pub tick_rate: f64,
pub mouse: bool,
pub paste: bool,
}Expand description
The Tui struct represents a terminal user interface.
It encapsulates ratatui::Terminal adding extra functionality:
- Tui::start and Tui::stop to start and stop the event loop
- Tui::enter and Tui::exit to enter and exit the crossterm terminal raw mode
- Mapping of crossterm events to Events
- Emits Event::Tick and Event::Render events at a specified rate
Fields§
§terminal: Terminal<CrosstermBackend<IO>>§task: JoinHandle<()>§cancellation_token: CancellationToken§event_rx: UnboundedReceiver<Event>§event_tx: UnboundedSender<Event>§frame_rate: f64§tick_rate: f64§mouse: bool§paste: boolImplementations§
Source§impl Tui
impl Tui
pub fn new() -> Result<Self, Error>
Sourcepub fn tick_rate(self, tick_rate: f64) -> Self
pub fn tick_rate(self, tick_rate: f64) -> Self
Sets the tick rate for the Tui. The tick rate is the number of times per second that the Tui will emit a Event::Tick event. The default tick rate is 4 ticks per second.
The tick is different from the render rate, which is the number of times per second that the application will be drawn to the screen. The tick rate is useful for updating the application state, performing calculations, run background tasks, and other operations that do not require a per-frame operation.
Tick rate will usually be lower than the frame rate.
Sourcepub fn frame_rate(self, frame_rate: f64) -> Self
pub fn frame_rate(self, frame_rate: f64) -> Self
Sets the frame rate for the Tui. The frame rate is the number of times per second that the Tui will emit a Event::Render event. The default frame rate is 60 frames per second.
The frame rate is the rate at which the application will be drawn to the screen (by calling
the draw method of each component).
Sourcepub fn mouse(self, mouse: bool) -> Self
pub fn mouse(self, mouse: bool) -> Self
Sets whether the Tui should capture mouse events. The default is false.
Sourcepub fn paste(self, paste: bool) -> Self
pub fn paste(self, paste: bool) -> Self
Sets whether the Tui should capture paste events. The default is false.
Sourcepub fn enter(&mut self) -> Result<(), Error>
pub fn enter(&mut self) -> Result<(), Error>
Enables cross-term raw mode and enters the alternate screen.
Sourcepub fn exit(&mut self) -> Result<(), Error>
pub fn exit(&mut self) -> Result<(), Error>
Disables cross-term raw mode and exits the alternate screen.
pub fn cancel(&self)
pub fn suspend(&mut self) -> Result<(), Error>
pub fn resume(&mut self) -> Result<(), Error>
Methods from Deref<Target = Terminal<Backend<IO>>>§
Sourcepub fn get_frame(&mut self) -> Frame<'_>
pub fn get_frame(&mut self) -> Frame<'_>
Get a Frame object which provides a consistent view into the terminal state for rendering.
Sourcepub fn current_buffer_mut(&mut self) -> &mut Buffer
pub fn current_buffer_mut(&mut self) -> &mut Buffer
Gets the current buffer as a mutable reference.
Sourcepub fn backend_mut(&mut self) -> &mut B
pub fn backend_mut(&mut self) -> &mut B
Gets the backend as a mutable reference
Examples found in repository?
39fn main() -> io::Result<()> {
40 let stdout = io::stdout();
41 let mut stdout = stdout.lock();
42 enable_raw_mode()?;
43 execute!(stdout, EnterAlternateScreen)?;
44 let backend = CrosstermBackend::new(stdout);
45 let mut term = Terminal::new(backend)?;
46
47 // Run the draw loop
48 run(&mut term)?;
49
50 disable_raw_mode()?;
51 execute!(term.backend_mut(), LeaveAlternateScreen)?;
52 term.show_cursor()?;
53 Ok(())
54}More examples
24fn main() -> io::Result<()> {
25 let stdout = io::stdout();
26 let mut stdout = stdout.lock();
27
28 enable_raw_mode()?;
29 execute!(stdout, EnterAlternateScreen)?;
30 let backend = CrosstermBackend::new(stdout);
31 let mut term = Terminal::new(backend)?;
32 let mut switch_state = false;
33
34 loop {
35 term.draw(|f| {
36 // Render the textarea
37 let switch =
38 Switch::with_status(switch_state).with_color_on(ratatui::style::Color::Green);
39
40 let [horiz] = Layout::horizontal([Constraint::Percentage(100)])
41 .flex(Flex::Center)
42 .areas(f.area());
43
44 let [verti] = Layout::vertical([Constraint::Length(2)]).flex(Flex::Center).areas(horiz);
45
46 let [centered] =
47 Layout::horizontal([Constraint::Length(14)]).flex(Flex::Center).areas(verti);
48
49 f.render_widget(switch, centered);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 } => break,
59 Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 }
65 | Input {
66 key: Key::Char(' '),
67 ..
68 } => {
69 switch_state = !switch_state;
70 }
71 _ => {}
72 }
73 }
74
75 disable_raw_mode()?;
76 execute!(term.backend_mut(), LeaveAlternateScreen)?;
77 term.show_cursor()?;
78
79 Ok(())
80}21fn main() -> io::Result<()> {
22 let stdout = io::stdout();
23 let mut stdout = stdout.lock();
24
25 enable_raw_mode()?;
26 execute!(stdout, EnterAlternateScreen)?;
27 let backend = CrosstermBackend::new(stdout);
28 let mut term = Terminal::new(backend)?;
29
30 let mut textarea = TextArea::default().with_block(
31 Block::default()
32 .borders(Borders::ALL)
33 .border_type(BorderType::Rounded)
34 .title(" Your name ")
35 .padding(Padding::horizontal(1)),
36 );
37
38 loop {
39 term.draw(|f| {
40 const MIN_HEIGHT: usize = 1;
41 let height = cmp::max(textarea.lines().len(), MIN_HEIGHT) as u16 + 2;
42 let layout = Layout::default()
43 .direction(Direction::Vertical)
44 .constraints([Constraint::Length(height), Constraint::Min(1)])
45 .split(f.area());
46
47 // Render the textarea
48 f.render_widget(&textarea, layout[0]);
49 f.render_widget(Paragraph::new("Press <Esc> to exit"), layout[1]);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 }
59 | Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 } => break,
65 input => {
66 textarea.input(input);
67 }
68 }
69 }
70
71 disable_raw_mode()?;
72 execute!(term.backend_mut(), LeaveAlternateScreen)?;
73 term.show_cursor()?;
74
75 println!("Lines: {:?}", textarea.lines());
76 Ok(())
77}Sourcepub fn flush(&mut self) -> Result<(), Error>
pub fn flush(&mut self) -> Result<(), Error>
Obtains a difference between the previous and the current buffer and passes it to the current backend for drawing.
Sourcepub fn resize(&mut self, area: Rect) -> Result<(), Error>
pub fn resize(&mut self, area: Rect) -> Result<(), Error>
Updates the Terminal so that internal buffers match the requested area.
Requested area will be saved to remain consistent when rendering. This leads to a full clear of the screen.
Sourcepub fn autoresize(&mut self) -> Result<(), Error>
pub fn autoresize(&mut self) -> Result<(), Error>
Queries the backend for size and resizes if it doesn’t match the previous size.
Sourcepub fn draw<F>(
&mut self,
render_callback: F,
) -> Result<CompletedFrame<'_>, Error>
pub fn draw<F>( &mut self, render_callback: F, ) -> Result<CompletedFrame<'_>, Error>
Draws a single frame to the terminal.
Returns a CompletedFrame if successful, otherwise a std::io::Error.
If the render callback passed to this method can fail, use try_draw instead.
Applications should call draw or try_draw in a loop to continuously render the
terminal. These methods are the main entry points for drawing to the terminal.
This method will:
- autoresize the terminal if necessary
- call the render callback, passing it a
Framereference to render to - flush the current internal state by copying the current buffer to the backend
- move the cursor to the last known position if it was set during the rendering closure
- return a
CompletedFramewith the current buffer and the area of the terminal
The CompletedFrame returned by this method can be useful for debugging or testing
purposes, but it is often not used in regular applicationss.
The render callback should fully render the entire frame when called, including areas that are unchanged from the previous frame. This is because each frame is compared to the previous frame to determine what has changed, and only the changes are written to the terminal. If the render callback does not fully render the frame, the terminal will not be in a consistent state.
§Examples
use ratatui::widgets::Paragraph;
// with a closure
terminal.draw(|frame| {
let area = frame.size();
frame.render_widget(Paragraph::new("Hello World!"), area);
frame.set_cursor_position(Position { x: 0, y: 0 });
})?;
// or with a function
terminal.draw(render)?;
fn render(frame: &mut ratatui::Frame) {
frame.render_widget(Paragraph::new("Hello World!"), frame.size());
}Examples found in repository?
24fn main() -> io::Result<()> {
25 let stdout = io::stdout();
26 let mut stdout = stdout.lock();
27
28 enable_raw_mode()?;
29 execute!(stdout, EnterAlternateScreen)?;
30 let backend = CrosstermBackend::new(stdout);
31 let mut term = Terminal::new(backend)?;
32 let mut switch_state = false;
33
34 loop {
35 term.draw(|f| {
36 // Render the textarea
37 let switch =
38 Switch::with_status(switch_state).with_color_on(ratatui::style::Color::Green);
39
40 let [horiz] = Layout::horizontal([Constraint::Percentage(100)])
41 .flex(Flex::Center)
42 .areas(f.area());
43
44 let [verti] = Layout::vertical([Constraint::Length(2)]).flex(Flex::Center).areas(horiz);
45
46 let [centered] =
47 Layout::horizontal([Constraint::Length(14)]).flex(Flex::Center).areas(verti);
48
49 f.render_widget(switch, centered);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 } => break,
59 Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 }
65 | Input {
66 key: Key::Char(' '),
67 ..
68 } => {
69 switch_state = !switch_state;
70 }
71 _ => {}
72 }
73 }
74
75 disable_raw_mode()?;
76 execute!(term.backend_mut(), LeaveAlternateScreen)?;
77 term.show_cursor()?;
78
79 Ok(())
80}More examples
21fn main() -> io::Result<()> {
22 let stdout = io::stdout();
23 let mut stdout = stdout.lock();
24
25 enable_raw_mode()?;
26 execute!(stdout, EnterAlternateScreen)?;
27 let backend = CrosstermBackend::new(stdout);
28 let mut term = Terminal::new(backend)?;
29
30 let mut textarea = TextArea::default().with_block(
31 Block::default()
32 .borders(Borders::ALL)
33 .border_type(BorderType::Rounded)
34 .title(" Your name ")
35 .padding(Padding::horizontal(1)),
36 );
37
38 loop {
39 term.draw(|f| {
40 const MIN_HEIGHT: usize = 1;
41 let height = cmp::max(textarea.lines().len(), MIN_HEIGHT) as u16 + 2;
42 let layout = Layout::default()
43 .direction(Direction::Vertical)
44 .constraints([Constraint::Length(height), Constraint::Min(1)])
45 .split(f.area());
46
47 // Render the textarea
48 f.render_widget(&textarea, layout[0]);
49 f.render_widget(Paragraph::new("Press <Esc> to exit"), layout[1]);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 }
59 | Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 } => break,
65 input => {
66 textarea.input(input);
67 }
68 }
69 }
70
71 disable_raw_mode()?;
72 execute!(term.backend_mut(), LeaveAlternateScreen)?;
73 term.show_cursor()?;
74
75 println!("Lines: {:?}", textarea.lines());
76 Ok(())
77}56fn run<B>(term: &mut Terminal<B>) -> io::Result<()>
57where
58 B: ratatui::backend::Backend,
59{
60 let items = vec![
61 Item::new("feat", "✨"),
62 Item::new("fix", "🐛"),
63 Item::new("chore", "🧹"),
64 Item::new("docs", "📚"),
65 Item::new("style", "💅"),
66 Item::new("refactor", "🔨"),
67 Item::new("perf", "🐎"),
68 Item::new("test", "🚨"),
69 Item::new("build", "👷"),
70 Item::new("ci", "🔧"),
71 Item::new("revert", "⏪"),
72 Item::new("release", "🚀"),
73 Item::new("wip", "🚧"),
74 ];
75
76 let mut grid_state = GridSelectorState::new(items).columns(5);
77
78 loop {
79 term.draw(|f| draw(f, f.area(), &mut grid_state))?;
80
81 match event::read()? {
82 Event::Key(key) => match key {
83 KeyEvent {
84 code: KeyCode::Esc, ..
85 } => break,
86 KeyEvent {
87 code: KeyCode::Right,
88 kind: KeyEventKind::Press,
89 ..
90 } => grid_state.move_right(),
91 KeyEvent {
92 code: KeyCode::Left,
93 kind: KeyEventKind::Press,
94 ..
95 } => grid_state.move_left(),
96 KeyEvent {
97 code: KeyCode::Up,
98 kind: KeyEventKind::Press,
99 ..
100 } => grid_state.move_up(),
101 KeyEvent {
102 code: KeyCode::Down,
103 kind: KeyEventKind::Press,
104 ..
105 } => grid_state.move_down(),
106 KeyEvent {
107 code: KeyCode::Home,
108 kind: KeyEventKind::Press,
109 ..
110 } => grid_state.move_to_row_start(),
111 KeyEvent {
112 code: KeyCode::End,
113 kind: KeyEventKind::Press,
114 ..
115 } => grid_state.move_to_row_end(),
116 // selection
117 KeyEvent {
118 code: KeyCode::Enter,
119 kind: KeyEventKind::Press,
120 ..
121 } => grid_state.select(),
122 _ => false,
123 },
124 _ => false,
125 };
126 }
127
128 Ok(())
129}Sourcepub fn try_draw<F, E>(
&mut self,
render_callback: F,
) -> Result<CompletedFrame<'_>, Error>
pub fn try_draw<F, E>( &mut self, render_callback: F, ) -> Result<CompletedFrame<'_>, Error>
Tries to draw a single frame to the terminal.
Returns Result::Ok containing a CompletedFrame if successful, otherwise
Result::Err containing the std::io::Error that caused the failure.
This is the equivalent of Terminal::draw but the render callback is a function or
closure that returns a Result instead of nothing.
Applications should call try_draw or draw in a loop to continuously render the
terminal. These methods are the main entry points for drawing to the terminal.
This method will:
- autoresize the terminal if necessary
- call the render callback, passing it a
Framereference to render to - flush the current internal state by copying the current buffer to the backend
- move the cursor to the last known position if it was set during the rendering closure
- return a
CompletedFramewith the current buffer and the area of the terminal
The render callback passed to try_draw can return any Result with an error type that
can be converted into an std::io::Error using the Into trait. This makes it possible
to use the ? operator to propagate errors that occur during rendering. If the render
callback returns an error, the error will be returned from try_draw as an
std::io::Error and the terminal will not be updated.
The CompletedFrame returned by this method can be useful for debugging or testing
purposes, but it is often not used in regular applicationss.
The render callback should fully render the entire frame when called, including areas that are unchanged from the previous frame. This is because each frame is compared to the previous frame to determine what has changed, and only the changes are written to the terminal. If the render function does not fully render the frame, the terminal will not be in a consistent state.
§Examples
use std::io;
use ratatui::widgets::Paragraph;
// with a closure
terminal.try_draw(|frame| {
let value: u8 = "not a number".parse().map_err(io::Error::other)?;
let area = frame.size();
frame.render_widget(Paragraph::new("Hello World!"), area);
frame.set_cursor_position(Position { x: 0, y: 0 });
io::Result::Ok(())
})?;
// or with a function
terminal.try_draw(render)?;
fn render(frame: &mut ratatui::Frame) -> io::Result<()> {
let value: u8 = "not a number".parse().map_err(io::Error::other)?;
frame.render_widget(Paragraph::new("Hello World!"), frame.size());
Ok(())
}Sourcepub fn hide_cursor(&mut self) -> Result<(), Error>
pub fn hide_cursor(&mut self) -> Result<(), Error>
Hides the cursor.
Sourcepub fn show_cursor(&mut self) -> Result<(), Error>
pub fn show_cursor(&mut self) -> Result<(), Error>
Shows the cursor.
Examples found in repository?
39fn main() -> io::Result<()> {
40 let stdout = io::stdout();
41 let mut stdout = stdout.lock();
42 enable_raw_mode()?;
43 execute!(stdout, EnterAlternateScreen)?;
44 let backend = CrosstermBackend::new(stdout);
45 let mut term = Terminal::new(backend)?;
46
47 // Run the draw loop
48 run(&mut term)?;
49
50 disable_raw_mode()?;
51 execute!(term.backend_mut(), LeaveAlternateScreen)?;
52 term.show_cursor()?;
53 Ok(())
54}More examples
24fn main() -> io::Result<()> {
25 let stdout = io::stdout();
26 let mut stdout = stdout.lock();
27
28 enable_raw_mode()?;
29 execute!(stdout, EnterAlternateScreen)?;
30 let backend = CrosstermBackend::new(stdout);
31 let mut term = Terminal::new(backend)?;
32 let mut switch_state = false;
33
34 loop {
35 term.draw(|f| {
36 // Render the textarea
37 let switch =
38 Switch::with_status(switch_state).with_color_on(ratatui::style::Color::Green);
39
40 let [horiz] = Layout::horizontal([Constraint::Percentage(100)])
41 .flex(Flex::Center)
42 .areas(f.area());
43
44 let [verti] = Layout::vertical([Constraint::Length(2)]).flex(Flex::Center).areas(horiz);
45
46 let [centered] =
47 Layout::horizontal([Constraint::Length(14)]).flex(Flex::Center).areas(verti);
48
49 f.render_widget(switch, centered);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 } => break,
59 Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 }
65 | Input {
66 key: Key::Char(' '),
67 ..
68 } => {
69 switch_state = !switch_state;
70 }
71 _ => {}
72 }
73 }
74
75 disable_raw_mode()?;
76 execute!(term.backend_mut(), LeaveAlternateScreen)?;
77 term.show_cursor()?;
78
79 Ok(())
80}21fn main() -> io::Result<()> {
22 let stdout = io::stdout();
23 let mut stdout = stdout.lock();
24
25 enable_raw_mode()?;
26 execute!(stdout, EnterAlternateScreen)?;
27 let backend = CrosstermBackend::new(stdout);
28 let mut term = Terminal::new(backend)?;
29
30 let mut textarea = TextArea::default().with_block(
31 Block::default()
32 .borders(Borders::ALL)
33 .border_type(BorderType::Rounded)
34 .title(" Your name ")
35 .padding(Padding::horizontal(1)),
36 );
37
38 loop {
39 term.draw(|f| {
40 const MIN_HEIGHT: usize = 1;
41 let height = cmp::max(textarea.lines().len(), MIN_HEIGHT) as u16 + 2;
42 let layout = Layout::default()
43 .direction(Direction::Vertical)
44 .constraints([Constraint::Length(height), Constraint::Min(1)])
45 .split(f.area());
46
47 // Render the textarea
48 f.render_widget(&textarea, layout[0]);
49 f.render_widget(Paragraph::new("Press <Esc> to exit"), layout[1]);
50 })?;
51 match event::read()?.into() {
52 Input { key: Key::Esc, .. }
53 | Input {
54 key: Key::Char('c'),
55 shift: false,
56 ctrl: true,
57 alt: false,
58 }
59 | Input {
60 key: Key::Enter,
61 ctrl: false,
62 shift: false,
63 alt: false,
64 } => break,
65 input => {
66 textarea.input(input);
67 }
68 }
69 }
70
71 disable_raw_mode()?;
72 execute!(term.backend_mut(), LeaveAlternateScreen)?;
73 term.show_cursor()?;
74
75 println!("Lines: {:?}", textarea.lines());
76 Ok(())
77}Sourcepub fn get_cursor(&mut self) -> Result<(u16, u16), Error>
👎Deprecated: the method get_cursor_position indicates more clearly what about the cursor to get
pub fn get_cursor(&mut self) -> Result<(u16, u16), Error>
the method get_cursor_position indicates more clearly what about the cursor to get
Gets the current cursor position.
This is the position of the cursor after the last draw call and is returned as a tuple of
(x, y) coordinates.
Sourcepub fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), Error>
👎Deprecated: the method set_cursor_position indicates more clearly what about the cursor to set
pub fn set_cursor(&mut self, x: u16, y: u16) -> Result<(), Error>
the method set_cursor_position indicates more clearly what about the cursor to set
Sets the cursor position.
Sourcepub fn get_cursor_position(&mut self) -> Result<Position, Error>
pub fn get_cursor_position(&mut self) -> Result<Position, Error>
Gets the current cursor position.
This is the position of the cursor after the last draw call.
Sourcepub fn set_cursor_position<P>(&mut self, position: P) -> Result<(), Error>
pub fn set_cursor_position<P>(&mut self, position: P) -> Result<(), Error>
Sets the cursor position.
Sourcepub fn clear(&mut self) -> Result<(), Error>
pub fn clear(&mut self) -> Result<(), Error>
Clear the terminal and force a full redraw on the next draw call.
Sourcepub fn swap_buffers(&mut self)
pub fn swap_buffers(&mut self)
Clears the inactive buffer and swaps it with the current buffer
Sourcepub fn insert_before<F>(&mut self, height: u16, draw_fn: F) -> Result<(), Error>
pub fn insert_before<F>(&mut self, height: u16, draw_fn: F) -> Result<(), Error>
Insert some content before the current inline viewport. This has no effect when the viewport is not inline.
The draw_fn closure will be called to draw into a writable Buffer that is height
lines tall. The content of that Buffer will then be inserted before the viewport.
If the viewport isn’t yet at the bottom of the screen, inserted lines will push it towards the bottom. Once the viewport is at the bottom of the screen, inserted lines will scroll the area of the screen above the viewport upwards.
Before:
+---------------------+
| pre-existing line 1 |
| pre-existing line 2 |
+---------------------+
| viewport |
+---------------------+
| |
| |
+---------------------+After inserting 2 lines:
+---------------------+
| pre-existing line 1 |
| pre-existing line 2 |
| inserted line 1 |
| inserted line 2 |
+---------------------+
| viewport |
+---------------------+
+---------------------+After inserting 2 more lines:
+---------------------+
| pre-existing line 2 |
| inserted line 1 |
| inserted line 2 |
| inserted line 3 |
| inserted line 4 |
+---------------------+
| viewport |
+---------------------+If more lines are inserted than there is space on the screen, then the top lines will go directly into the terminal’s scrollback buffer. At the limit, if the viewport takes up the whole screen, all lines will be inserted directly into the scrollback buffer.
§Examples
§Insert a single line before the current viewport
terminal.insert_before(1, |buf| {
Paragraph::new(Line::from(vec![
Span::raw("This line will be added "),
Span::styled("before", Style::default().fg(Color::Blue)),
Span::raw(" the current viewport"),
]))
.render(buf.area, buf);
});Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tui
impl RefUnwindSafe for Tui
impl Send for Tui
impl Sync for Tui
impl Unpin for Tui
impl UnsafeUnpin for Tui
impl UnwindSafe for Tui
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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