Skip to content

Commit

Permalink
Attempt to add optional rustc-serialize
Browse files Browse the repository at this point in the history
Fails because of rust-lang/rust#22250
  • Loading branch information
vi committed Aug 24, 2015
1 parent c237cf4 commit 4a63d50
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ description = "[incomplete yet] Matroska (mkv,webm) files parser and generator i
[dependencies]
byteorder = "0.3.5"
log = "0.3"
rustc-serialize = { version = "0.3", optional = true }
4 changes: 4 additions & 0 deletions src/elements/database.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use super::Type::*;


macro_rules! elements_database {
($($cl:ident $t:ident $id:expr),*,) => {
#[derive(Debug,Eq,PartialEq,Copy,Ord,PartialOrd,Clone)]
// XXX https://github.com/rust-lang/rust/issues/22250
#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
pub enum Class {
$($cl),*
,Unknown
}


pub fn id_to_class(id:u64) -> Class {
use self::Class::*;

Expand Down
2 changes: 2 additions & 0 deletions src/elements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub enum Type {
// Element DOM

#[derive(PartialEq,Debug,PartialOrd,Clone)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
pub enum ElementContent {
Master(Vec<Rc<Element>>),
Unsigned(u64),
Expand All @@ -35,6 +36,7 @@ pub enum ElementContent {
}

#[derive(PartialEq,Debug,PartialOrd,Clone)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
pub struct Element {
class : database::Class,
content : ElementContent,
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
#![feature(slice_patterns)]
#![feature(vec_push_all)]
#![feature(append)]
#![cfg_attr(feature = "rustc-serialize", feature(custom_derive))]


#[macro_use]
extern crate log;

#[cfg(feature = "rustc-serialize")] extern crate rustc_serialize;

pub mod elements;

0 comments on commit 4a63d50

Please sign in to comment.