oct 0.35.0

Octonary transcodings.
Documentation
// Copyright 2024-2026 Gabriel Bjørnager Jensen.
//
// SPDX: MIT OR Apache-2.0

//! Serialisation/deserialisation facilities.
//!
//! This module provides portable serialisation and
//! deserialisation algorithms, e.g. for network
//! communications.
//!
//! # Examples
//!
#![cfg_attr(feature = "proc_macro", doc = include_str!("serdes_derive_examples.md"))]

#![doc(alias = "serde")]

#![cfg(feature = "serdes")]

mod deserialise;
mod max_serialised_size;
mod serialise;
mod slot;

pub use deserialise::Deserialise;
pub use max_serialised_size::MaxSerialisedSize;
pub use serialise::Serialise;
pub use slot::Slot;

/// Implements [`Deserialise`] for the given type.
///
/// [`Deserialise`]: trait@Deserialise
#[cfg(feature = "proc_macro")]
#[doc(inline)]
pub use oct_macros::Deserialise;

/// Implements [`MaxSerialisedSize`] for the given type.
///
/// [`MaxSerialisedSize`]: trait@MaxSerialisedSize
#[cfg(feature = "proc_macro")]
#[doc(inline)]
pub use oct_macros::MaxSerialisedSize;

/// Implements [`Serialise`] for the given type.
///
/// [`Serialise`]: trait@Serialise
#[cfg(feature = "proc_macro")]
#[doc(inline)]
pub use oct_macros::Serialise;

/// The discriminant value for [`Bound::Included`].
///
/// [`Bound::Included`]: core::ops::Bound::Included
const BOUND_INCLUDED: u8 = 0;

/// The discriminant value for [`Bound::Excluded`].
///
/// [`Bound::Excluded`]: core::ops::Bound::Excluded
const BOUND_EXCLUDED: u8 = 1;

/// The discriminant value for [`Bound::Unbounded`].
///
/// [`Bound::Unbounded`]: core::ops::Bound::Unbounded
const BOUND_UNBOUNDED: u8 = 2;

/// The discriminant value for [`IpAddr::V4`].
///
/// [`IpAddr::V4`]: core::net::IpAddr::V4
const IP_ADDR_V4: u8 = 4;

/// The discriminant value for [`IpAddr::V6`].
///
/// [`IpAddr::V6`]: core::net::IpAddr::V6
const IP_ADDR_V6: u8 = 6;

/// The discriminant value for [`Option::None`].
const OPTION_NONE: u8 = 0;

/// The discriminant value for [`Option::Some`].
const OPTION_SOME: u8 = 1;

/// The discriminant value for [`SocketAddr::V4`].
///
/// [`SocketAddr::V4`]: core::net::SocketAddr::V4
const SOCKET_ADDR_V4: u8 = 4;

/// The discriminant value for [`SocketAddr::V6`].
///
/// [`SocketAddr::V6`]: core::net::SocketAddr::V6
const SOCKET_ADDR_V6: u8 = 6;

/// The discriminant value for [`Result::Ok`].
const RESULT_OK: u8 = 0;

/// The discriminant value for [`Result::Err`].
const RESULT_ERR: u8 = 1;