Fix docs logo (again); Update docs (add examples);

This commit is contained in:
Gabriel Bjørnager Jensen 2024-08-08 11:41:12 +02:00
parent 5041f391c0
commit f20b2bd249
4 changed files with 37 additions and 4 deletions

View file

@ -3,6 +3,11 @@
This is the changelog of `bzipper`.
See `"README.md"` for more information.
## 0.4.6
* Fix docs logo (again)
* Update docs (add examples)
## 0.4.5
* Fix package metadata :(

View file

@ -1,6 +1,6 @@
[package]
name = "bzipper"
version = "0.4.5"
version = "0.4.6"
authors = ["Gabriel Bjørnager Jensen"]
edition = "2021"
description = "Binary (de)serialiser."

View file

@ -6,6 +6,5 @@
<polyline fill="none" points="76,68 76,76 20,76 59.029437252,20" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="8" />
</mask>
<rect fill="#FFFFFF" height="100%" width="100%" x="0" y="0" />
<rect fill="#B4202D" height="100%" mask="url(#z)" width="100%" x="0" y="0" />
<rect fill="#FFFFFF" height="100%" mask="url(#z)" width="100%" x="0" y="0" />
</svg>

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 544 B

Before After
Before After

View file

@ -34,10 +34,39 @@ use core::num::NonZero;
pub trait Serialise: Sized {
/// The error of serialisation.
///
/// Use [`Infallible`] if **all** deserialisations are infallible, as is the case of zero-length types.
/// Use [`Infallible`] if **all** deserialisations are infallible, as is the case of zero-length types (such as [the unit type](unit)).
type Error;
/// The maximum amount of bytes that can result from serialisation.
///
/// Until derive macros are implemented, this value should be set to the sum of the members' own size limits (if chaining is used, that is):
///
/// ```
/// use bzipper::{Serialise, Sstream};
///
/// struct Foo {
/// bar: u16,
/// baz: f32,
/// }
///
/// impl Serialise for Foo {
/// type Error = bzipper::Error;
///
/// const SERIALISE_LIMIT: usize = u16::SERIALISE_LIMIT + f32::SERIALISE_LIMIT;
///
/// fn serialise(&self, stream: &mut Sstream) -> Result<usize, Self::Error> {
/// let mut count = 0x0;
///
/// // Serialise fields using chaining.
/// count += self.bar.serialise(stream)?;
/// count += self.baz.serialise(stream)?;
///
/// Ok(count)
/// }
/// }
/// ```
///
/// In the future, dervice macros will make manual chaining redundant.
const SERIALISE_LIMIT: usize;
/// Serialises `self` into a byte stream.