committed by
GitHub
parent
07bec55b7d
commit
a42a17e184
@@ -1,5 +1,8 @@
|
||||
//! The [`BarChart`] widget and its related types (e.g. [`Bar`], [`BarGroup`]).
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Direction, Rect};
|
||||
use ratatui_core::style::{Style, Styled};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use alloc::string::{String, ToString};
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::Rect;
|
||||
use ratatui_core::style::{Style, Styled};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Alignment, Rect};
|
||||
use ratatui_core::style::Style;
|
||||
@@ -65,6 +67,7 @@ impl<'a> BarGroup<'a> {
|
||||
///
|
||||
/// BarGroup::default().label(Line::from("Line").red());
|
||||
/// ```
|
||||
/// [`String`]: alloc::string::String
|
||||
#[must_use = "method moves the value of self and returns the modified value"]
|
||||
pub fn label<T: Into<Line<'a>>>(mut self, label: T) -> Self {
|
||||
self.label = Some(label.into());
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
//! [title](Block::title) and [padding](Block::padding).
|
||||
#![allow(deprecated)] // to avoid having to add `#[deprecated]` to every use of `Title`
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Alignment, Rect};
|
||||
@@ -900,6 +902,8 @@ impl Styled for Block<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::{format, vec};
|
||||
|
||||
use ratatui_core::layout::HorizontalAlignment;
|
||||
use ratatui_core::style::{Color, Modifier, Stylize};
|
||||
use rstest::rstest;
|
||||
|
||||
@@ -143,6 +143,8 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::string::ToString;
|
||||
|
||||
use rstest::rstest;
|
||||
use strum::ParseError;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Border related types ([`Borders`], [`BorderType`]) and a macro to create borders ([`border`]).
|
||||
use core::fmt;
|
||||
use alloc::fmt;
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ratatui_core::symbols::border;
|
||||
@@ -254,6 +254,8 @@ macro_rules! border {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::format;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
//! * a style is returned by the [`DateStyler`] for the day
|
||||
//!
|
||||
//! [`Monthly`] has several controls for what should be displayed
|
||||
use alloc::format;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hashbrown::HashMap;
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Alignment, Constraint, Layout, Rect};
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
//!
|
||||
//! You can also implement your own custom [`Shape`]s.
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::String;
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use core::fmt;
|
||||
use core::iter::zip;
|
||||
|
||||
|
||||
@@ -58,6 +58,8 @@ impl Shape for Map {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::string::ToString;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::Rect;
|
||||
use ratatui_core::symbols::Marker;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! The [`Chart`] widget is used to plot one or more [`Dataset`] in a cartesian coordinate system.
|
||||
use alloc::vec::Vec;
|
||||
use core::cmp::max;
|
||||
use core::ops::Not;
|
||||
|
||||
@@ -1155,6 +1156,9 @@ impl Styled for Chart<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::string::ToString;
|
||||
use alloc::{format, vec};
|
||||
|
||||
use ratatui_core::style::{Modifier, Stylize};
|
||||
use rstest::rstest;
|
||||
use strum::ParseError;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//! The [`Gauge`] widget is used to display a horizontal progress bar.
|
||||
use alloc::format;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::Rect;
|
||||
use ratatui_core::style::{Color, Style, Styled};
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
//!
|
||||
//! This project is licensed under the MIT License. See the [LICENSE](../LICENSE) file for details.
|
||||
|
||||
#![no_std]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub mod barchart;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
//! The [`List`] widget is used to display a list of items and allows selecting one or multiple
|
||||
//! items.
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use ratatui_core::style::{Style, Styled};
|
||||
use ratatui_core::text::Line;
|
||||
use strum::{Display, EnumString};
|
||||
@@ -459,6 +462,8 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::{format, vec};
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui_core::style::{Color, Modifier, Stylize};
|
||||
|
||||
|
||||
@@ -219,6 +219,8 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::borrow::Cow;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui_core::style::{Color, Modifier, Stylize};
|
||||
|
||||
@@ -255,6 +255,10 @@ impl List<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::borrow::ToOwned;
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui_core::layout::{Alignment, Rect};
|
||||
use ratatui_core::style::{Color, Modifier, Style, Stylize};
|
||||
|
||||
@@ -174,6 +174,7 @@ impl Widget for RatatuiMascot {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::string::String;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -493,6 +493,8 @@ impl Styled for Paragraph<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::vec;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Alignment, Rect};
|
||||
use ratatui_core::style::{Color, Modifier, Style, Stylize};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//! Internal module for reflowing text to fit into a certain width.
|
||||
use alloc::collections::VecDeque;
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
use core::mem;
|
||||
|
||||
use ratatui_core::layout::Alignment;
|
||||
@@ -351,6 +353,9 @@ fn trim_offset(src: &str, mut offset: usize) -> &str {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::String;
|
||||
|
||||
use ratatui_core::style::Style;
|
||||
use ratatui_core::text::{Line, Text};
|
||||
|
||||
|
||||
@@ -636,6 +636,8 @@ impl ScrollbarOrientation {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::format;
|
||||
use alloc::string::ToString;
|
||||
use core::str::FromStr;
|
||||
|
||||
use ratatui_core::text::Text;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
//! The [`Sparkline`] widget is used to display a sparkline over one or more lines.
|
||||
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use core::cmp::min;
|
||||
|
||||
use ratatui_core::buffer::Buffer;
|
||||
@@ -434,6 +437,8 @@ impl Sparkline<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::vec;
|
||||
|
||||
use ratatui_core::buffer::Cell;
|
||||
use ratatui_core::style::{Color, Modifier, Stylize};
|
||||
use strum::ParseError;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! The [`Table`] widget is used to display multiple rows and columns in a grid and allows selecting
|
||||
//! one or multiple cells.
|
||||
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::{Constraint, Flex, Layout, Rect};
|
||||
@@ -1036,7 +1039,8 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::vec;
|
||||
use alloc::string::ToString;
|
||||
use alloc::{format, vec};
|
||||
|
||||
use ratatui_core::layout::Constraint::*;
|
||||
use ratatui_core::style::{Color, Modifier, Style, Stylize};
|
||||
|
||||
@@ -40,6 +40,8 @@ impl HighlightSpacing {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::string::ToString;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use ratatui_core::style::{Style, Styled};
|
||||
|
||||
use super::Cell;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//! The [`Tabs`] widget displays a horizontal set of tabs with a single tab selected.
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use ratatui_core::buffer::Buffer;
|
||||
use ratatui_core::layout::Rect;
|
||||
@@ -122,6 +124,7 @@ impl<'a> Tabs<'a> {
|
||||
///
|
||||
/// let tabs = Tabs::new(vec!["Tab 1".red(), "Tab 2".blue()]);
|
||||
/// ```
|
||||
/// [`String`]: alloc::string::String
|
||||
pub fn new<Iter>(titles: Iter) -> Self
|
||||
where
|
||||
Iter: IntoIterator,
|
||||
@@ -444,6 +447,8 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use alloc::{format, vec};
|
||||
|
||||
use ratatui_core::style::{Color, Stylize};
|
||||
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user