Stop using deriving for types with phantom params
This commit is contained in:
parent
2064ba86ad
commit
a8cf28d428
@ -1,8 +1,6 @@
|
|||||||
//! Types dealing with ranges of values
|
//! Types dealing with ranges of values
|
||||||
#[macro_escape];
|
#[macro_escape];
|
||||||
|
|
||||||
extern crate extra;
|
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::i32;
|
use std::i32;
|
||||||
@ -141,11 +139,9 @@ trait BoundSided {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A tag type representing an upper bound
|
/// A tag type representing an upper bound
|
||||||
#[deriving(Eq,Clone)]
|
|
||||||
pub enum UpperBound {}
|
pub enum UpperBound {}
|
||||||
|
|
||||||
/// A tag type representing a lower bound
|
/// A tag type representing a lower bound
|
||||||
#[deriving(Eq,Clone)]
|
|
||||||
pub enum LowerBound {}
|
pub enum LowerBound {}
|
||||||
|
|
||||||
impl BoundSided for UpperBound {
|
impl BoundSided for UpperBound {
|
||||||
@ -172,7 +168,6 @@ pub enum BoundType {
|
|||||||
/// Represents a one-sided bound.
|
/// Represents a one-sided bound.
|
||||||
///
|
///
|
||||||
/// The side is determined by the `S` phantom parameter.
|
/// The side is determined by the `S` phantom parameter.
|
||||||
#[deriving(Clone)]
|
|
||||||
pub struct RangeBound<S, T> {
|
pub struct RangeBound<S, T> {
|
||||||
/// The value of the bound
|
/// The value of the bound
|
||||||
value: T,
|
value: T,
|
||||||
@ -180,6 +175,15 @@ pub struct RangeBound<S, T> {
|
|||||||
type_: BoundType
|
type_: BoundType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S: BoundSided, T: Clone> Clone for RangeBound<S, T> {
|
||||||
|
fn clone(&self) -> RangeBound<S, T> {
|
||||||
|
RangeBound {
|
||||||
|
value: self.value.clone(),
|
||||||
|
type_: self.type_.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<S: BoundSided, T: fmt::Show> fmt::Show for RangeBound<S, T> {
|
impl<S: BoundSided, T: fmt::Show> fmt::Show for RangeBound<S, T> {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let chars = match self.type_ {
|
let chars = match self.type_ {
|
||||||
|
Loading…
Reference in New Issue
Block a user