librbml: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio 2014-12-14 22:46:05 -05:00
parent a18d090c3c
commit fd4a5d9ef1

View File

@ -41,15 +41,13 @@ use std::str;
pub mod io;
/// Common data structures
#[deriving(Clone)]
#[deriving(Clone, Copy)]
pub struct Doc<'a> {
pub data: &'a [u8],
pub start: uint,
pub end: uint,
}
impl<'doc> Copy for Doc<'doc> {}
impl<'doc> Doc<'doc> {
pub fn new(data: &'doc [u8]) -> Doc<'doc> {
Doc { data: data, start: 0u, end: data.len() }
@ -73,7 +71,7 @@ pub struct TaggedDoc<'a> {
pub doc: Doc<'a>,
}
#[deriving(Show)]
#[deriving(Copy, Show)]
pub enum EbmlEncoderTag {
EsUint, // 0
EsU64, // 1
@ -107,8 +105,6 @@ pub enum EbmlEncoderTag {
EsLabel, // Used only when debugging
}
impl Copy for EbmlEncoderTag {}
#[deriving(Show)]
pub enum Error {
IntTooBig(uint),
@ -151,13 +147,12 @@ pub mod reader {
)
}
#[deriving(Copy)]
pub struct Res {
pub val: uint,
pub next: uint
}
impl Copy for Res {}
#[inline(never)]
fn vuint_at_slow(data: &[u8], start: uint) -> DecodeResult<Res> {
let a = data[start];