Skip to content

Commit

Permalink
DOC: Mention serde-1 feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bluss committed Sep 11, 2017
1 parent cea481f commit f33c4e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ matches = { version = "0.1" }
[features]
default = ["std"]
std = ["odds/std", "nodrop/std"]
use_union = ["nodrop/use_union"]
use_union = []
serde-1 = ["serde"]

[package.metadata.docs.rs]
Expand Down
2 changes: 2 additions & 0 deletions src/array_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ impl<A: Array<Item=u8>> Ord for ArrayString<A> {
}

#[cfg(feature="serde-1")]
/// Requires crate feature `"serde-1"`
impl<A: Array<Item=u8>> Serialize for ArrayString<A> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer
Expand All @@ -380,6 +381,7 @@ impl<A: Array<Item=u8>> Serialize for ArrayString<A> {
}

#[cfg(feature="serde-1")]
/// Requires crate feature `"serde-1"`
impl<'de, A: Array<Item=u8>> Deserialize<'de> for ArrayString<A> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>
Expand Down
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
//! to do nothing in the future.
//! - Use the unstable feature untagged unions for the internal implementation,
//! which may have reduced space overhead
//! - `serde-1`
//! - Optional
//! - Enable serialization for ArrayVec and ArrayString using serde 1.0
//!
//! ## Rust Version
//!
Expand Down Expand Up @@ -48,8 +51,12 @@ use std::fmt;
#[cfg(feature="std")]
use std::io;

#[cfg(not(feature="use_union"))]
use nodrop::NoDrop;

#[cfg(feature="use_union")]
use std::mem::ManuallyDrop as NoDrop;

#[cfg(feature="serde-1")]
use serde::{Serialize, Deserialize, Serializer, Deserializer};

Expand Down Expand Up @@ -965,6 +972,7 @@ impl<A: Array<Item=u8>> io::Write for ArrayVec<A> {
}

#[cfg(feature="serde-1")]
/// Requires crate feature `"serde-1"`
impl<T: Serialize, A: Array<Item=T>> Serialize for ArrayVec<A> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer
Expand All @@ -974,6 +982,7 @@ impl<T: Serialize, A: Array<Item=T>> Serialize for ArrayVec<A> {
}

#[cfg(feature="serde-1")]
/// Requires crate feature `"serde-1"`
impl<'de, T: Deserialize<'de>, A: Array<Item=T>> Deserialize<'de> for ArrayVec<A> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>
Expand Down

0 comments on commit f33c4e4

Please sign in to comment.