libfmt_macros: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio
2014-12-14 22:36:39 -05:00
parent 30cefcbdfd
commit 4c62c76ef9

View File

@@ -35,7 +35,7 @@ use std::string;
/// A piece is a portion of the format string which represents the next part /// A piece is a portion of the format string which represents the next part
/// to emit. These are emitted as a stream by the `Parser` class. /// to emit. These are emitted as a stream by the `Parser` class.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Piece<'a> { pub enum Piece<'a> {
/// A literal string which should directly be emitted /// A literal string which should directly be emitted
String(&'a str), String(&'a str),
@@ -44,10 +44,8 @@ pub enum Piece<'a> {
NextArgument(Argument<'a>), NextArgument(Argument<'a>),
} }
impl<'a> Copy for Piece<'a> {}
/// Representation of an argument specification. /// Representation of an argument specification.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub struct Argument<'a> { pub struct Argument<'a> {
/// Where to find this argument /// Where to find this argument
pub position: Position<'a>, pub position: Position<'a>,
@@ -55,10 +53,8 @@ pub struct Argument<'a> {
pub format: FormatSpec<'a>, pub format: FormatSpec<'a>,
} }
impl<'a> Copy for Argument<'a> {}
/// Specification for the formatting of an argument in the format string. /// Specification for the formatting of an argument in the format string.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub struct FormatSpec<'a> { pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with /// Optionally specified character to fill alignment with
pub fill: Option<char>, pub fill: Option<char>,
@@ -76,10 +72,8 @@ pub struct FormatSpec<'a> {
pub ty: &'a str pub ty: &'a str
} }
impl<'a> Copy for FormatSpec<'a> {}
/// Enum describing where an argument for a format can be located. /// Enum describing where an argument for a format can be located.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Position<'a> { pub enum Position<'a> {
/// The argument will be in the next position. This is the default. /// The argument will be in the next position. This is the default.
ArgumentNext, ArgumentNext,
@@ -89,10 +83,8 @@ pub enum Position<'a> {
ArgumentNamed(&'a str), ArgumentNamed(&'a str),
} }
impl<'a> Copy for Position<'a> {}
/// Enum of alignments which are supported. /// Enum of alignments which are supported.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Alignment { pub enum Alignment {
/// The value will be aligned to the left. /// The value will be aligned to the left.
AlignLeft, AlignLeft,
@@ -104,11 +96,9 @@ pub enum Alignment {
AlignUnknown, AlignUnknown,
} }
impl Copy for Alignment {}
/// Various flags which can be applied to format strings. The meaning of these /// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves. /// flags is defined by the formatters themselves.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Flag { pub enum Flag {
/// A `+` will be used to denote positive numbers. /// A `+` will be used to denote positive numbers.
FlagSignPlus, FlagSignPlus,
@@ -122,11 +112,9 @@ pub enum Flag {
FlagSignAwareZeroPad, FlagSignAwareZeroPad,
} }
impl Copy for Flag {}
/// A count is used for the precision and width parameters of an integer, and /// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer. /// can reference either an argument or a literal integer.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Count<'a> { pub enum Count<'a> {
/// The count is specified explicitly. /// The count is specified explicitly.
CountIs(uint), CountIs(uint),
@@ -140,8 +128,6 @@ pub enum Count<'a> {
CountImplied, CountImplied,
} }
impl<'a> Copy for Count<'a> {}
/// The parser structure for interpreting the input format string. This is /// The parser structure for interpreting the input format string. This is
/// modelled as an iterator over `Piece` structures to form a stream of tokens /// modelled as an iterator over `Piece` structures to form a stream of tokens
/// being output. /// being output.