use std::ops::{Deref, DerefMut};
use crate::ChUnit;
#[derive(Debug, Copy, Clone, Default, PartialEq, Ord, PartialOrd, Eq, Hash)]
pub struct ByteIndex(pub usize);
pub fn byte_index(arg_byte_index: impl Into<ByteIndex>) -> ByteIndex {
arg_byte_index.into()
}
impl Deref for ByteIndex {
type Target = usize;
fn deref(&self) -> &Self::Target { &self.0 }
}
impl DerefMut for ByteIndex {
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
}
impl From<usize> for ByteIndex {
fn from(it: usize) -> Self { Self(it) }
}
impl From<ChUnit> for ByteIndex {
fn from(it: ChUnit) -> Self { Self(crate::usize(it)) }
}