fray 0.1.2

A type-safe and ergonomic Rust library for working with bitfields.
Documentation
//! Module defining bit numbering orders used by bitfields.
//!
//! This module provides the marker types [`LSB0`] and [`MSB0`], as well as
//! the trait [`BitOrder`]. These types are used by the
//! [`BitFieldImpl::BitOrder`](crate::BitFieldImpl::BitOrder) associated
//! type to indicate the bit ordering chosen for a bitfield.
//!
//! - [`LSB0`] — Least Significant Bit first (default).
//! - [`MSB0`] — Most Significant Bit first.

use super::private::Sealed;

#[allow(missing_debug_implementations)]
/// Least Significant Bit first bit ordering.
///
/// Used as a type-level marker by [`BitFieldImpl::BitOrder`](crate::BitFieldImpl::BitOrder) when
/// a bitfield has `#[bitfield(bitorder(lsb0))]` (the default).
pub enum LSB0 {}
impl Sealed for LSB0 {}
impl BitOrder for LSB0 {}

#[allow(missing_debug_implementations)]
/// Most Significant Bit first bit ordering.
///
/// Used as a type-level marker by [`BitFieldImpl::BitOrder`](crate::BitFieldImpl::BitOrder) when
/// a bitfield has `#[bitfield(bitorder(msb0))]`.
pub enum MSB0 {}
impl Sealed for MSB0 {}
impl BitOrder for MSB0 {}

/// Trait representing a bit numbering order for a bitfield.
///
/// Implemented by the marker types [`LSB0`] and [`MSB0`].
/// This trait is used by the [`BitFieldImpl::BitOrder`](crate::BitFieldImpl::BitOrder) associated type
/// to indicate the chosen bit ordering of a bitfield.
///
/// It is sealed to prevent external implementations.
pub trait BitOrder: Sealed {}