Skip to content

Commit

Permalink
Unignore doctests where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Aug 6, 2021
1 parent e0ac324 commit 9a1d2a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/config/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,16 @@ pub struct FixintEncoding;
/// fn zigzag(v: Signed) -> Unsigned {
/// match v {
/// 0 => 0,
/// v if v < 0 => |v| * 2 - 1
/// v if v < 0 => |v| * 2 - 1,
/// v if v > 0 => v * 2
/// }
/// }
/// ```
///
/// And works such that:
///
/// ```ignore
/// ```no_run
/// # let zigzag = |_| 0;
/// assert_eq!(zigzag(0), 0);
/// assert_eq!(zigzag(-1), 1);
/// assert_eq!(zigzag(1), 2);
Expand Down
10 changes: 6 additions & 4 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ pub mod read;
/// The ByteOrder that is chosen will impact the endianness that
/// is used to read integers out of the reader.
///
/// ```ignore
/// let d = Deserializer::new(&mut some_reader, SizeLimit::new());
/// serde::Deserialize::deserialize(&mut deserializer);
/// let bytes_read = d.bytes_read();
/// ```
/// # use bincode::Deserializer;
/// let input = [3];
/// let mut deserializer = Deserializer::from_slice(&input, bincode::options());
/// let value: u32 = serde::Deserialize::deserialize(&mut deserializer).unwrap();
/// assert_eq!(value, 3);
/// ```
pub struct Deserializer<R, O: Options> {
pub(crate) reader: R,
Expand Down
10 changes: 10 additions & 0 deletions src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ use std::mem::size_of;
///
/// This struct should not be used often.
/// For most cases, prefer the `encode_into` function.
///
/// ```
/// # use bincode::Serializer;
/// # use serde::ser::Serialize;
/// let mut output: Vec<u8> = vec!();
/// let mut serializer = Serializer::new(&mut output, bincode::options());
/// let value = 3u32;
/// value.serialize(&mut serializer).unwrap();
/// assert_eq!(output, [3]);
/// ```
pub struct Serializer<W, O: Options> {
writer: W,
_options: O,
Expand Down

0 comments on commit 9a1d2a4

Please sign in to comment.