Skip to content

Commit

Permalink
api: add Clone impls
Browse files Browse the repository at this point in the history
There's no reason not to have these. I suspect I didn't add them
originally because types like `std::io::Stdout` don't implement `Clone`.
And so, the structures that contain them can't either. But that's not
true of all `std::io::Write` implementations.
  • Loading branch information
BurntSushi committed Nov 14, 2023
1 parent dbe5733 commit da784a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1179,11 +1179,11 @@ impl BufferWriter {
/// method, which will take color preferences and the environment into
/// account. However, buffers can also be manually created using `no_color`,
/// `ansi` or `console` (on Windows).
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Buffer(BufferInner);

/// BufferInner is an enumeration of different buffer types.
#[derive(Debug)]
#[derive(Clone, Debug)]
enum BufferInner {
/// No coloring information should be applied. This ignores all coloring
/// directives.
Expand Down Expand Up @@ -1383,7 +1383,7 @@ impl WriteColor for Buffer {
}

/// Satisfies `WriteColor` but ignores all color options.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct NoColor<W>(W);

impl<W: Write> NoColor<W> {
Expand Down Expand Up @@ -1454,7 +1454,7 @@ impl<W: io::Write> WriteColor for NoColor<W> {
}

/// Satisfies `WriteColor` using standard ANSI escape sequences.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Ansi<W>(W);

impl<W: Write> Ansi<W> {
Expand Down

0 comments on commit da784a9

Please sign in to comment.