feat: add missing `Clone` and `Copy` on types

pull/269/head
Florian Dehau 4 years ago
parent 4f728d363f
commit bc2a512101

@ -8,6 +8,7 @@ pub mod block {
pub const ONE_QUARTER: &str = "▎";
pub const ONE_EIGHTH: &str = "▏";
#[derive(Debug, Clone)]
pub struct Set {
pub full: &'static str,
pub seven_eighths: &'static str,
@ -55,6 +56,7 @@ pub mod bar {
pub const ONE_QUARTER: &str = "▂";
pub const ONE_EIGHTH: &str = "▁";
#[derive(Debug, Clone)]
pub struct Set {
pub full: &'static str,
pub seven_eighths: &'static str,
@ -141,6 +143,7 @@ pub mod line {
pub const DOUBLE_CROSS: &str = "╬";
pub const THICK_CROSS: &str = "╋";
#[derive(Debug, Clone)]
pub struct Set {
pub vertical: &'static str,
pub horizontal: &'static str,

@ -25,6 +25,7 @@ use unicode_width::UnicodeWidthStr;
/// .data(&[("B0", 0), ("B1", 2), ("B2", 4), ("B3", 3)])
/// .max(4);
/// ```
#[derive(Debug, Clone)]
pub struct BarChart<'a> {
/// Block to wrap the widget in
block: Option<Block<'a>>,

@ -4,7 +4,7 @@ use crate::style::Style;
use crate::symbols::line;
use crate::widgets::{Borders, Widget};
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Clone, Copy)]
pub enum BorderType {
Plain,
Rounded,
@ -39,7 +39,7 @@ impl BorderType {
/// .border_type(BorderType::Rounded)
/// .style(Style::default().bg(Color::Black));
/// ```
#[derive(Clone, Copy)]
#[derive(Debug, Clone, Copy)]
pub struct Block<'a> {
/// Optional title place on the upper left of the block
title: Option<&'a str>,

@ -12,6 +12,7 @@ use std::{borrow::Cow, cmp::max};
use unicode_width::UnicodeWidthStr;
/// An X or Y axis for the chart widget
#[derive(Debug, Clone)]
pub struct Axis<'a, L>
where
L: AsRef<str> + 'a,
@ -82,6 +83,7 @@ where
}
/// Used to determine which style of graphing to use
#[derive(Debug, Clone, Copy)]
pub enum GraphType {
/// Draw each point
Scatter,
@ -90,6 +92,7 @@ pub enum GraphType {
}
/// A group of data points
#[derive(Debug, Clone)]
pub struct Dataset<'a> {
/// Name of the dataset (used in the legend if shown)
name: Cow<'a, str>,
@ -217,6 +220,7 @@ impl Default for ChartLayout {
/// .style(Style::default().fg(Color::Magenta))
/// .data(&[(4.0, 5.0), (5.0, 8.0), (7.66, 13.5)])]);
/// ```
#[derive(Debug, Clone)]
pub struct Chart<'a, LX, LY>
where
LX: AsRef<str> + 'a,

@ -22,6 +22,7 @@ use crate::widgets::Widget;
///
/// For a more complete example how to utilize `Clear` to realize popups see
/// the example `examples/popup.rs`
#[derive(Debug, Clone)]
pub struct Clear;
impl Widget for Clear {

@ -17,6 +17,7 @@ use crate::widgets::{Block, Widget};
/// .style(Style::default().fg(Color::White).bg(Color::Black).modifier(Modifier::ITALIC))
/// .percent(20);
/// ```
#[derive(Debug, Clone)]
pub struct Gauge<'a> {
block: Option<Block<'a>>,
ratio: f64,

@ -7,6 +7,7 @@ use crate::layout::{Corner, Rect};
use crate::style::Style;
use crate::widgets::{Block, StatefulWidget, Text, Widget};
#[derive(Debug, Clone)]
pub struct ListState {
offset: usize,
selected: Option<usize>,
@ -48,6 +49,7 @@ impl ListState {
/// .highlight_style(Style::default().modifier(Modifier::ITALIC))
/// .highlight_symbol(">>");
/// ```
#[derive(Debug, Clone)]
pub struct List<'b, L>
where
L: Iterator<Item = Text<'b>>,

@ -47,7 +47,7 @@ bitflags! {
}
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub enum Text<'b> {
Raw(Cow<'b, str>),
Styled(Cow<'b, str>, Style),

@ -34,6 +34,7 @@ fn get_line_offset(line_width: u16, text_area_width: u16, alignment: Alignment)
/// .alignment(Alignment::Center)
/// .wrap(true);
/// ```
#[derive(Debug, Clone)]
pub struct Paragraph<'a, 't, T>
where
T: Iterator<Item = &'t Text<'t>>,

@ -20,6 +20,7 @@ use std::cmp::min;
/// .max(5)
/// .style(Style::default().fg(Color::Red).bg(Color::White));
/// ```
#[derive(Debug, Clone)]
pub struct Sparkline<'a> {
/// A block to wrap the widget in
block: Option<Block<'a>>,

@ -16,6 +16,7 @@ use std::{
};
use unicode_width::UnicodeWidthStr;
#[derive(Debug, Clone)]
pub struct TableState {
offset: usize,
selected: Option<usize>,
@ -44,6 +45,7 @@ impl TableState {
}
/// Holds data to be displayed in a Table widget
#[derive(Debug, Clone)]
pub enum Row<D>
where
D: Iterator,
@ -77,6 +79,7 @@ where
/// .style(Style::default().fg(Color::White))
/// .column_spacing(1);
/// ```
#[derive(Debug, Clone)]
pub struct Table<'a, H, R> {
/// A block to wrap the widget in
block: Option<Block<'a>>,

@ -21,6 +21,7 @@ use crate::widgets::{Block, Widget};
/// .highlight_style(Style::default().fg(Color::Yellow))
/// .divider(DOT);
/// ```
#[derive(Debug, Clone)]
pub struct Tabs<'a, T>
where
T: AsRef<str> + 'a,

Loading…
Cancel
Save