diff --git a/Cargo.toml b/Cargo.toml index 24206ac..6379e0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ tokio = ["tokio_1", "futures-core"] [dependencies] libc = "0.2.89" -bitvec = "0.22" +bitvec = "1.0.0-rc1" nix = "0.23" tokio_1 = { package = "tokio", version = "1.0", features = ["net"], optional = true } diff --git a/src/attribute_set.rs b/src/attribute_set.rs index ac47a12..f3d6868 100644 --- a/src/attribute_set.rs +++ b/src/attribute_set.rs @@ -10,20 +10,20 @@ use std::ops::{Deref, DerefMut}; #[repr(transparent)] pub struct AttributeSetRef { _indexer: std::marker::PhantomData, - bitslice: BitSlice, + bitslice: BitSlice, } impl AttributeSetRef { #[inline] - fn new(bitslice: &BitSlice) -> &Self { - // SAFETY: for AttributeSet is repr(transparent) over BitSlice - unsafe { &*(bitslice as *const BitSlice as *const Self) } + fn new(bitslice: &BitSlice) -> &Self { + // SAFETY: for AttributeSet is repr(transparent) over BitSlice + unsafe { &*(bitslice as *const BitSlice as *const Self) } } #[inline] - fn new_mut(bitslice: &mut BitSlice) -> &mut Self { - // SAFETY: for AttributeSet is repr(transparent) over BitSlice - unsafe { &mut *(bitslice as *mut BitSlice as *mut Self) } + fn new_mut(bitslice: &mut BitSlice) -> &mut Self { + // SAFETY: for AttributeSet is repr(transparent) over BitSlice + unsafe { &mut *(bitslice as *mut BitSlice as *mut Self) } } /// Returns `true` if this AttributeSet contains the passed T. @@ -75,11 +75,11 @@ impl AttributeSet { } } - fn as_bitslice(&self) -> &BitSlice { + fn as_bitslice(&self) -> &BitSlice { T::array_as_slice(&self.container) } - fn as_mut_bitslice(&mut self) -> &mut BitSlice { + fn as_mut_bitslice(&mut self) -> &mut BitSlice { T::array_as_slice_mut(&mut self.container) } @@ -135,8 +135,8 @@ pub trait EvdevEnum: Copy + 'static { pub trait ArrayedEvdevEnum: EvdevEnum { type Array; - fn array_as_slice(arr: &Self::Array) -> &BitSlice; - fn array_as_slice_mut(arr: &mut Self::Array) -> &mut BitSlice; + fn array_as_slice(arr: &Self::Array) -> &BitSlice; + fn array_as_slice_mut(arr: &mut Self::Array) -> &mut BitSlice; fn array_as_buf(arr: &mut Self::Array) -> &mut [u8]; fn zeroed_array() -> Self::Array; } @@ -146,8 +146,8 @@ macro_rules! evdev_enum { evdev_enum!( $t, Array: bitvec::BitArr!(for <$t>::COUNT, in u8), - bitvec::array::BitArray::as_mut_raw_slice, - bitvec::array::BitArray::zeroed(), + bitvec::array::BitArray::as_raw_mut_slice, + bitvec::array::BitArray::ZERO, $($(#[$attr])* $c = $val,)* ); }; @@ -155,8 +155,8 @@ macro_rules! evdev_enum { evdev_enum!( $t, Array: Box::COUNT, in u8)>, - bitvec::array::BitArray::as_mut_raw_slice, - Box::new(bitvec::array::BitArray::zeroed()), + bitvec::array::BitArray::as_raw_mut_slice, + Box::new(bitvec::array::BitArray::ZERO), $($(#[$attr])* $c = $val,)* ); }; @@ -167,10 +167,10 @@ macro_rules! evdev_enum { ) => { impl $crate::attribute_set::ArrayedEvdevEnum for $t { type Array = $Array; - fn array_as_slice(arr: &Self::Array) -> &bitvec::slice::BitSlice { + fn array_as_slice(arr: &Self::Array) -> &bitvec::slice::BitSlice { arr } - fn array_as_slice_mut(arr: &mut Self::Array) -> &mut bitvec::slice::BitSlice { + fn array_as_slice_mut(arr: &mut Self::Array) -> &mut bitvec::slice::BitSlice { arr } fn array_as_buf(arr: &mut Self::Array) -> &mut [u8] {