pub(crate) fn new(
		addr: Address<M, T>,
		head: BitIdx<T::Mem>,
		bits: usize,
	) -> Result<Self, BitSpanError<T>> {
		if bits > Self::REGION_MAX_BITS {
			return Err(BitSpanError::TooLong(bits));
		}
		let base = BitPtr::<M, T, O>::new(addr, head)?;
		let last = base.wrapping_add(bits);
		if last < base {
			return Err(BitSpanError::TooHigh(addr.to_const()));
		}

		Ok(unsafe { Self::new_unchecked(addr, head, bits) })
	}
/// Creates a new bit-span from its logical components.
///
/// ## Parameters
///
/// - `addr`: The base address of the memory region in which the bit-span
///   resides.
/// - `head`: The index of the initial bit within `*addr`.
/// - `bits`: The number of bits contained in the bit-span.
///
/// ## Returns
///
/// This fails in the following conditions:
///
/// - `bits` is greater than `REGION_MAX_BITS`
/// - `addr` is not aligned to `T`.
/// - `addr + elts(bits)` wraps around the address space
///
/// The `Address` type already enforces the non-null requirement.
Creates a new bit-span from its logical components.
Creates a new bit - span from its logical components .
pub(crate) fn new(
		addr: Address<M, T>,
		head: BitIdx<T::Mem>,
		bits: usize,
	) -> Result<Self, BitSpanError<T>> {
		if bits > Self::REGION_MAX_BITS {
			return Err(BitSpanError::TooLong(bits));
		}
		let base = BitPtr::<M, T, O>::new(addr, head)?;
		let last = base.wrapping_add(bits);
		if last < base {
			return Err(BitSpanError::TooHigh(addr.to_const()));
		}
		Ok(unsafe { Self::new_unchecked(addr, head, bits) })
	}
pub ( crate ) fn new ( addr : Address < M , T > , head : BitIdx < T :: Mem > , bits : usize , ) -> Result < Self , BitSpanError < T > > { if bits > Self :: REGION_MAX_BITS { return Err ( BitSpanError :: TooLong ( bits ) ) ; } let base = BitPtr :: < M , T , O > :: new ( addr , head ) ? ; let last = base . wrapping_add ( bits ) ; if last < base { return Err ( BitSpanError :: TooHigh ( addr . to_const ( ) ) ) ; } Ok ( unsafe { Self :: new_unchecked ( addr , head , bits ) } ) }
Creates a new bit-span from its logical components.
Creates a new bit - span from its logical components .
addr
Address<M, T>
head
BitIdx<T::Mem>
bits
usize
None
it
None
dd
wraps around the address space

The `Address` type already enforces the non-null requirement.
wraps around the address space The ` Address ` type already enforces the non - null requirement .
ddr + elts(bits
addr
Address<M, T>
The base address of the memory region in which the bit-span
resides.
The base address of the memory region in which the bit - span resides .
head
BitIdx<T::Mem>
The index of the initial bit within `*addr`.
The index of the initial bit within ` * addr ` .
bits
usize
The number of bits contained in the bit-span.
The number of bits contained in the bit - span .