chore: some docs clean-up

This commit is contained in:
Dylan Bowker
2024-05-12 08:39:41 -06:00
committed by Vincent Herlemont
parent 646673efda
commit dac9ddb4c0
7 changed files with 40 additions and 31 deletions
@@ -1,4 +1,4 @@
//! ⚠️ [`Read the docs before using`](crate::bincode_1_3::Bincode#warning).
//! ⚠️ [`Read the docs before using`](crate::bincode_1_3::Bincode#warning) -
//! Annotate your type with `native_model::bincode_1_3::Bincode` to use the
//! bincode 1.3 crate for serializing & deserializing.
@@ -1,4 +1,4 @@
//! ⚠️ [`Read the docs before using`](crate::bincode_2_rc::Bincode#warning).
//! ⚠️ [`Read the docs before using`](crate::bincode_2_rc::Bincode#warning) -
//! Annotate your type with `native_model::bincode_2_rc::Bincode` to use
//! the bincode 2.0.0-rc.3 crate for serializing & deserializing.
+13 -1
View File
@@ -14,7 +14,7 @@ pub mod rmp_serde_1_3;
///
/// Example:
/// ```rust
/// use bincode_2_rc::{error::EncodeError,serde::encode_to_vec, config::standard};
/// use bincode_2_rc::{error::EncodeError,serde::encode_to_vec, config::standard};
/// use serde::Serialize;
/// pub struct Bincode;
///
@@ -27,6 +27,12 @@ pub mod rmp_serde_1_3;
/// ```
pub trait Encode<T> {
type Error;
/// Encodes a `T` type into a series of bytes.
///
/// # Errors
///
/// The errors returned from this function depend on the trait implementor
/// (the serializer), i.e. `bincode_2_rc`.
fn encode(obj: &T) -> Result<Vec<u8>, Self::Error>;
}
@@ -46,5 +52,11 @@ pub trait Encode<T> {
/// }
pub trait Decode<T> {
type Error;
/// Decodes a series of bytes back into a `T` type.
///
/// # Errors
///
/// The errors returned from this function depend on the trait implementor
/// (the deserializer), i.e. `bincode_2_rc`.
fn decode(data: Vec<u8>) -> Result<T, Self::Error>;
}
@@ -1,4 +1,4 @@
//! ⚠️ [`Read the docs before using`](crate::postcard_1_0::PostCard#warning).
//! ⚠️ [`Read the docs before using`](crate::postcard_1_0::PostCard#warning) -
//! Annotate your type with `native_model::postcard_1_0::PostCard` to
//! use the postcard 1.0 crate for serializing & deserializing.