]> git.lizzy.rs Git - rust.git/commitdiff
librbml: use `#[deriving(Copy)]`
authorJorge Aparicio <japaricious@gmail.com>
Mon, 15 Dec 2014 03:46:05 +0000 (22:46 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Fri, 19 Dec 2014 15:43:24 +0000 (10:43 -0500)
src/librbml/lib.rs

index bb7af92eb54522a220b65fddb64ad5199ae65b30..19e79b1eb7b2d4cf7bca0c6b7e91c023c81e7599 100644 (file)
 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 @@ macro_rules! try_or {
         )
     }
 
+    #[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];