chore: remove leftover prelude refs / glob imports from example code (#1430)

Fixes: <https://github.com/ratatui/ratatui/issues/1150>

Co-authored-by: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
This commit is contained in:
Josh McKinney 2024-10-19 02:54:34 -07:00 committed by GitHub
parent 453a308b46
commit f6f7794dd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 19 deletions

View File

@ -1,5 +1,15 @@
//! A prelude for conveniently writing applications using this library.
//!
//! The prelude module is no longer used universally in Ratatui, as it can make it harder to
//! distinguish between library and non-library types, especially when viewing source code
//! outside of an IDE (such as on GitHub or in a git diff). For more details and user feedback,
//! see [Issue #1150]. However, the prelude is still available for backward compatibility and for
//! those who prefer to use it.
//!
//! [Issue #1150]: https://github.com/ratatui/ratatui/issues/1150
//!
//! # Examples
//!
//! ```rust,no_run
//! use ratatui::prelude::*;
//! ```

View File

@ -38,8 +38,7 @@
//! - [`Span`]s can be styled again, which will merge the styles.
//! - Many widget types can be styled directly rather than calling their `style()` method.
//!
//! See the [`Stylize`] and [`Styled`] traits for more information. These traits are re-exported in
//! the [`prelude`] module for convenience.
//! See the [`Stylize`] and [`Styled`] traits for more information.
//!
//! ## Example
//!
@ -72,7 +71,6 @@
//! );
//! ```
//!
//! [`prelude`]: crate::prelude
//! [`Span`]: crate::text::Span
use std::fmt;

View File

@ -595,7 +595,7 @@ impl<'a> Table<'a> {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::{layout::Constraint, style::{Style, Stylize}, widgets::{Row, Table}};
/// # let rows = [Row::new(vec!["Cell1", "Cell2"])];
/// # let widths = [Constraint::Length(5), Constraint::Length(5)];
/// let table = Table::new(rows, widths).row_highlight_style(Style::new().red().italic());
@ -620,7 +620,7 @@ impl<'a> Table<'a> {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::{layout::Constraint, style::{Style, Stylize}, widgets::{Row, Table}};
/// # let rows = [Row::new(vec!["Cell1", "Cell2"])];
/// # let widths = [Constraint::Length(5), Constraint::Length(5)];
/// let table = Table::new(rows, widths).column_highlight_style(Style::new().red().italic());
@ -645,7 +645,7 @@ impl<'a> Table<'a> {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::{layout::Constraint, style::{Style, Stylize}, widgets::{Row, Table}};
/// # let rows = [Row::new(vec!["Cell1", "Cell2"])];
/// # let widths = [Constraint::Length(5), Constraint::Length(5)];
/// let table = Table::new(rows, widths).cell_highlight_style(Style::new().red().italic());

View File

@ -123,7 +123,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let state = TableState::new().with_selected_column(Some(1));
/// ```
#[must_use = "method moves the value of self and returns the modified value"]
@ -142,7 +142,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let state = TableState::new().with_selected_cell(Some((1, 5)));
/// ```
#[must_use = "method moves the value of self and returns the modified value"]
@ -212,7 +212,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let state = TableState::new();
/// assert_eq!(state.selected_column(), None);
/// ```
@ -227,7 +227,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let state = TableState::new();
/// assert_eq!(state.selected_cell(), None);
/// ```
@ -261,7 +261,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// *state.selected_column_mut() = Some(1);
/// ```
@ -293,7 +293,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_column(Some(1));
/// ```
@ -308,7 +308,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_cell(Some((1, 5)));
/// ```
@ -349,7 +349,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_next_column();
/// ```
@ -384,7 +384,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_previous_column();
/// ```
@ -420,7 +420,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_first_column();
/// ```
@ -453,7 +453,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.select_last();
/// ```
@ -508,7 +508,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.scroll_right_by(4);
/// ```
@ -526,7 +526,7 @@ impl TableState {
/// # Examples
///
/// ```rust
/// # use ratatui::{prelude::*, widgets::*};
/// # use ratatui::widgets::{TableState};
/// let mut state = TableState::default();
/// state.scroll_left_by(4);
/// ```