mirror of https://git.sr.ht/~stygianentity/bincode
Added documentation for the src/ module. Added warning for missing docs, fixed missing docs in src/de/mod.rs
This commit is contained in:
parent
7b85fc168e
commit
b480d2b3b3
|
|
@ -101,6 +101,9 @@ pub trait Config: InternalConfig {
|
|||
|
||||
impl<T: InternalConfig> Config for T {}
|
||||
|
||||
/// The default config. By default this will be:
|
||||
/// - Little endian
|
||||
/// - Variable int encoding
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Default;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
//! Decoder-based structs and traits.
|
||||
|
||||
use crate::error::DecodeError;
|
||||
|
||||
mod decoder;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub enum DecodeError {
|
|||
/// the max index of the enum.
|
||||
max: u32,
|
||||
|
||||
// The index of the enum that the decoder encountered
|
||||
/// The index of the enum that the decoder encountered
|
||||
found: u32,
|
||||
},
|
||||
|
||||
|
|
@ -48,8 +48,10 @@ pub enum DecodeError {
|
|||
Utf8(core::str::Utf8Error),
|
||||
}
|
||||
|
||||
/// Integer types. Used by [DecodeError]. These types have no purpose other than being shown in errors.
|
||||
#[non_exhaustive]
|
||||
#[derive(Debug)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum IntegerType {
|
||||
U16,
|
||||
U32,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
//! Bincode is a crate for encoding and decoding using a tiny binary
|
||||
//! serialization strategy. Using it, you can easily go from having
|
||||
|
|
@ -58,10 +59,10 @@ pub fn encode_into_slice<E: enc::Encodeable>(
|
|||
pub fn encode_into_slice_with_config<E: enc::Encodeable, C: Config>(
|
||||
val: E,
|
||||
dst: &mut [u8],
|
||||
_config: C,
|
||||
config: C,
|
||||
) -> Result<usize, error::EncodeError> {
|
||||
let writer = enc::write::SliceWriter::new(dst);
|
||||
let mut encoder = enc::Encoder::<_, C>::new(writer);
|
||||
let mut encoder = enc::Encoder::<_, C>::new(writer, config);
|
||||
val.encode(&mut encoder)?;
|
||||
Ok(encoder.into_writer().bytes_written())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue