Upgrade to bitvec 1.0.0-rc1 in prep for 1.0 release in January
This commit is contained in:
parent
3966c797e2
commit
77d7b9f0e7
2 changed files with 18 additions and 18 deletions
|
@ -13,7 +13,7 @@ tokio = ["tokio_1", "futures-core"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.89"
|
libc = "0.2.89"
|
||||||
bitvec = "0.22"
|
bitvec = "1.0.0-rc1"
|
||||||
nix = "0.23"
|
nix = "0.23"
|
||||||
|
|
||||||
tokio_1 = { package = "tokio", version = "1.0", features = ["net"], optional = true }
|
tokio_1 = { package = "tokio", version = "1.0", features = ["net"], optional = true }
|
||||||
|
|
|
@ -10,20 +10,20 @@ use std::ops::{Deref, DerefMut};
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct AttributeSetRef<T> {
|
pub struct AttributeSetRef<T> {
|
||||||
_indexer: std::marker::PhantomData<T>,
|
_indexer: std::marker::PhantomData<T>,
|
||||||
bitslice: BitSlice<Lsb0, u8>,
|
bitslice: BitSlice<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: EvdevEnum> AttributeSetRef<T> {
|
impl<T: EvdevEnum> AttributeSetRef<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn new(bitslice: &BitSlice<Lsb0, u8>) -> &Self {
|
fn new(bitslice: &BitSlice<u8>) -> &Self {
|
||||||
// SAFETY: for<T> AttributeSet<T> is repr(transparent) over BitSlice<Lsb0, u8>
|
// SAFETY: for<T> AttributeSet<T> is repr(transparent) over BitSlice<u8>
|
||||||
unsafe { &*(bitslice as *const BitSlice<Lsb0, u8> as *const Self) }
|
unsafe { &*(bitslice as *const BitSlice<u8> as *const Self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn new_mut(bitslice: &mut BitSlice<Lsb0, u8>) -> &mut Self {
|
fn new_mut(bitslice: &mut BitSlice<u8>) -> &mut Self {
|
||||||
// SAFETY: for<T> AttributeSet<T> is repr(transparent) over BitSlice<Lsb0, u8>
|
// SAFETY: for<T> AttributeSet<T> is repr(transparent) over BitSlice<u8>
|
||||||
unsafe { &mut *(bitslice as *mut BitSlice<Lsb0, u8> as *mut Self) }
|
unsafe { &mut *(bitslice as *mut BitSlice<u8> as *mut Self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this AttributeSet contains the passed T.
|
/// Returns `true` if this AttributeSet contains the passed T.
|
||||||
|
@ -75,11 +75,11 @@ impl<T: ArrayedEvdevEnum> AttributeSet<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_bitslice(&self) -> &BitSlice<Lsb0, u8> {
|
fn as_bitslice(&self) -> &BitSlice<u8> {
|
||||||
T::array_as_slice(&self.container)
|
T::array_as_slice(&self.container)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_mut_bitslice(&mut self) -> &mut BitSlice<Lsb0, u8> {
|
fn as_mut_bitslice(&mut self) -> &mut BitSlice<u8> {
|
||||||
T::array_as_slice_mut(&mut self.container)
|
T::array_as_slice_mut(&mut self.container)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ pub trait EvdevEnum: Copy + 'static {
|
||||||
|
|
||||||
pub trait ArrayedEvdevEnum: EvdevEnum {
|
pub trait ArrayedEvdevEnum: EvdevEnum {
|
||||||
type Array;
|
type Array;
|
||||||
fn array_as_slice(arr: &Self::Array) -> &BitSlice<Lsb0, u8>;
|
fn array_as_slice(arr: &Self::Array) -> &BitSlice<u8>;
|
||||||
fn array_as_slice_mut(arr: &mut Self::Array) -> &mut BitSlice<Lsb0, u8>;
|
fn array_as_slice_mut(arr: &mut Self::Array) -> &mut BitSlice<u8>;
|
||||||
fn array_as_buf(arr: &mut Self::Array) -> &mut [u8];
|
fn array_as_buf(arr: &mut Self::Array) -> &mut [u8];
|
||||||
fn zeroed_array() -> Self::Array;
|
fn zeroed_array() -> Self::Array;
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,8 @@ macro_rules! evdev_enum {
|
||||||
evdev_enum!(
|
evdev_enum!(
|
||||||
$t,
|
$t,
|
||||||
Array: bitvec::BitArr!(for <$t>::COUNT, in u8),
|
Array: bitvec::BitArr!(for <$t>::COUNT, in u8),
|
||||||
bitvec::array::BitArray::as_mut_raw_slice,
|
bitvec::array::BitArray::as_raw_mut_slice,
|
||||||
bitvec::array::BitArray::zeroed(),
|
bitvec::array::BitArray::ZERO,
|
||||||
$($(#[$attr])* $c = $val,)*
|
$($(#[$attr])* $c = $val,)*
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -155,8 +155,8 @@ macro_rules! evdev_enum {
|
||||||
evdev_enum!(
|
evdev_enum!(
|
||||||
$t,
|
$t,
|
||||||
Array: Box<bitvec::BitArr!(for <$t>::COUNT, in u8)>,
|
Array: Box<bitvec::BitArr!(for <$t>::COUNT, in u8)>,
|
||||||
bitvec::array::BitArray::as_mut_raw_slice,
|
bitvec::array::BitArray::as_raw_mut_slice,
|
||||||
Box::new(bitvec::array::BitArray::zeroed()),
|
Box::new(bitvec::array::BitArray::ZERO),
|
||||||
$($(#[$attr])* $c = $val,)*
|
$($(#[$attr])* $c = $val,)*
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -167,10 +167,10 @@ macro_rules! evdev_enum {
|
||||||
) => {
|
) => {
|
||||||
impl $crate::attribute_set::ArrayedEvdevEnum for $t {
|
impl $crate::attribute_set::ArrayedEvdevEnum for $t {
|
||||||
type Array = $Array;
|
type Array = $Array;
|
||||||
fn array_as_slice(arr: &Self::Array) -> &bitvec::slice::BitSlice<bitvec::order::Lsb0, u8> {
|
fn array_as_slice(arr: &Self::Array) -> &bitvec::slice::BitSlice<u8> {
|
||||||
arr
|
arr
|
||||||
}
|
}
|
||||||
fn array_as_slice_mut(arr: &mut Self::Array) -> &mut bitvec::slice::BitSlice<bitvec::order::Lsb0, u8> {
|
fn array_as_slice_mut(arr: &mut Self::Array) -> &mut bitvec::slice::BitSlice<u8> {
|
||||||
arr
|
arr
|
||||||
}
|
}
|
||||||
fn array_as_buf(arr: &mut Self::Array) -> &mut [u8] {
|
fn array_as_buf(arr: &mut Self::Array) -> &mut [u8] {
|
||||||
|
|
Loading…
Reference in a new issue