use crate::bits_mut::BitsMut;
use crate::endian::{BigEndian, Endian, LittleEndian};
pub trait BitsOwned: Sized + BitsMut {
const BITS: u32;
const ZEROS: Self;
const ONES: Self;
type IntoIterOnes: Iterator<Item = u32>;
type IntoIterOnesIn<E>: Iterator<Item = u32>
where
E: Endian;
type IntoIterZeros: Iterator<Item = u32>;
type IntoIterZerosIn<E>: Iterator<Item = u32>
where
E: Endian;
fn zeros() -> Self;
fn ones() -> Self;
#[must_use]
fn with_bit_in<E>(self, bit: u32) -> Self
where
E: Endian;
#[must_use]
fn with_bit(self, bit: u32) -> Self;
#[must_use]
#[inline]
fn with_bit_le(self, bit: u32) -> Self {
self.with_bit_in::<LittleEndian>(bit)
}
#[must_use]
#[inline]
fn with_bit_be(self, bit: u32) -> Self {
self.with_bit_in::<BigEndian>(bit)
}
#[must_use]
fn without_bit_in<E>(self, bit: u32) -> Self
where
E: Endian;
#[must_use]
fn without_bit(self, bit: u32) -> Self;
#[must_use]
#[inline]
fn without_bit_le(self, bit: u32) -> Self {
self.without_bit_in::<LittleEndian>(bit)
}
#[must_use]
#[inline]
fn without_bit_be(self, bit: u32) -> Self {
self.without_bit_in::<BigEndian>(bit)
}
#[must_use]
fn union(self, other: Self) -> Self;
#[must_use]
fn conjunction(self, other: Self) -> Self;
#[must_use]
fn difference(self, other: Self) -> Self;
#[must_use]
fn symmetric_difference(self, other: Self) -> Self;
fn into_iter_ones(self) -> Self::IntoIterOnes;
fn into_iter_ones_in<E>(self) -> Self::IntoIterOnesIn<E>
where
E: Endian;
#[inline]
fn into_iter_ones_le(self) -> Self::IntoIterOnesIn<LittleEndian> {
self.into_iter_ones_in()
}
#[inline]
fn into_iter_ones_be(self) -> Self::IntoIterOnesIn<BigEndian> {
self.into_iter_ones_in()
}
fn into_iter_zeros(self) -> Self::IntoIterZeros;
fn into_iter_zeros_in<E>(self) -> Self::IntoIterZerosIn<E>
where
E: Endian;
#[inline]
fn into_iter_zeros_le(self) -> Self::IntoIterZerosIn<LittleEndian> {
self.into_iter_zeros_in()
}
#[inline]
fn into_iter_zeros_be(self) -> Self::IntoIterZerosIn<BigEndian> {
self.into_iter_zeros_in()
}
}