Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serde support. #10

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "vob"
description = "Vector of Bits with Vec-like API and usize backing storage"
repository = "https://github.com/softdevteam/vob/"
version = "1.0.0"
version = "1.1.0"
authors = ["Laurence Tratt <[email protected]>"]
readme = "README.md"
# This should be "Apache-2.0 OR MIT OR UPL-1.0" but crates.io doesn't know about
Expand All @@ -12,3 +12,4 @@ categories = ["data-structures"]

[dependencies]
num-traits = "0.2.1"
serde = { version="1.0", features=["derive"], optional=true }
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
//! The main documentation for this crate can be found in the [`Vob`](struct.Vob.html) struct.

extern crate num_traits;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde;

use std::cmp::{min, PartialEq};
use std::fmt;
Expand Down Expand Up @@ -101,6 +104,7 @@ use range::{Included, Excluded, RangeBounds, Unbounded};
/// (keeping the length unchanged). The same effect as `BitVec`'s `clear` can be achieved by using
/// `Vob`'s [`set_all(false)`](struct.Vob.html#method.set_all) function.
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Vob<T=usize> {
/// How many bits are stored in this Vob?
len: usize,
Expand Down