1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 08:34:07 +02:00

rename to IsPadded

This commit is contained in:
Robin Appelman 2019-02-22 22:35:01 +01:00
commit 26bc7f9350
2 changed files with 6 additions and 6 deletions

View file

@ -47,19 +47,19 @@ pub struct NonPadded;
pub struct Padded;
/// Determine whether or not the source slice is padded
pub trait MaybePaddedSlice {
pub trait IsPadded {
/// Whether or not the slice is padded
fn is_padded() -> bool;
}
impl MaybePaddedSlice for NonPadded {
impl IsPadded for NonPadded {
#[inline]
fn is_padded() -> bool {
false
}
}
impl MaybePaddedSlice for Padded {
impl IsPadded for Padded {
#[inline]
fn is_padded() -> bool {
true
@ -100,7 +100,7 @@ pub type Result<T> = std::result::Result<T, ReadError>;
pub struct BitBuffer<'a, E, S>
where
E: Endianness,
S: MaybePaddedSlice
S: IsPadded
{
bytes: &'a [u8],
bit_len: usize,
@ -179,7 +179,7 @@ impl<'a, E> BitBuffer<'a, E, Padded>
impl<'a, E, S> BitBuffer<'a, E, S>
where
E: Endianness,
S: MaybePaddedSlice
S: IsPadded
{
/// The available number of bits in the buffer
pub fn bit_len(&self) -> usize {

View file

@ -222,7 +222,7 @@ fn read_f64_le() {
assert_eq!(buffer.read_float::<f64>(6).unwrap(), 135447455835963910000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0);
}
fn read_perf<E: Endianness, S: MaybePaddedSlice>(buffer: BitBuffer<E, S>) -> u16 {
fn read_perf<P: IsPadded>(buffer: BitBuffer<LittleEndian, P>) -> u16 {
let size = 5;
let mut pos = 0;
let len = buffer.bit_len();