From a90e931caadd8e7bfe18cfcf081541503387333d Mon Sep 17 00:00:00 2001 From: myrrlyn Date: Mon, 13 Jan 2020 12:03:09 -0700 Subject: [PATCH] Patch for `0.17.1` --- CHANGELOG.md | 19 +++++++++++++++++++ Cargo.toml | 2 +- src/bits.rs | 24 +++++------------------- src/lib.rs | 30 ++++++++++++++++++++++++++++++ src/prelude.rs | 5 ++++- src/slice/tests.rs | 2 +- src/slice/traits.rs | 2 +- 7 files changed, 61 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 434c0ac3..105eb4f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes will be documented in this file. This document is written according to the [Keep a Changelog][kac] style. +## 0.17.1 + +### Added + +This patch restores the `cursor` module and its types, as aliases to the `order` +module and their equivalents, with a deprecation warning. Removing these names +entirely, without a deprecation redirect, is technically permissible but morally +in error. + +### Changed + +In addition, the `Bits` trait has been renamed to `AsBits`, to better reflect +its behavior and reduce the chances of name collision, as it is a prelude +export. + +### Removed + +The `AsBits::as_{mut_,}bitslice` deprecation aliases have been removed. + ## 0.17.0 ### Added diff --git a/Cargo.toml b/Cargo.toml index 1c541531..73a9c235 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ [package] name = "bitvec" -version = "0.17.0" +version = "0.17.1" authors = [ "myrrlyn ", ] diff --git a/src/bits.rs b/src/bits.rs index 8cf1f4a7..19f474ec 100644 --- a/src/bits.rs +++ b/src/bits.rs @@ -1,6 +1,6 @@ /*! Permit use of Rust native types as bit collections. -This module exposes a trait, `Bits`, which functions similarly to the `AsRef` +This module exposes a trait, `AsBits`, which functions similarly to the `AsRef` and `AsMut` traits in the standard library. This trait allows an implementor to express the means by which it can be interpreted as a collection of bits. !*/ @@ -18,7 +18,7 @@ use crate::{ This trait can only be implemented by contiguous structures: individual fundamentals, and sequences (arrays or slices) of them. **/ -pub trait Bits { +pub trait AsBits { /// The underlying fundamental type of the implementor. type Store: BitStore; @@ -49,13 +49,6 @@ pub trait Bits { fn bits(&self) -> &BitSlice where O: BitOrder; - /// Synonym for [`bits`](#method.bits). - #[deprecated(since = "0.16.0", note = "Use `Bits::bits` instead")] - fn as_bitslice(&self) -> &BitSlice - where O: BitOrder { - Bits::bits(self) - } - /// Constructs a mutable `BitSlice` reference over data. /// /// # Type Parameters @@ -84,16 +77,9 @@ pub trait Bits { /// ``` fn bits_mut(&mut self) -> &mut BitSlice where O: BitOrder; - - /// Synonym for [`bits_mut`](#method.bits_mut). - #[deprecated(since = "0.16.0", note = "Use `Bits::bits_mut` instead")] - fn as_mut_bitslice(&mut self) -> &mut BitSlice - where O: BitOrder { - Bits::bits_mut(self) - } } -impl Bits for T +impl AsBits for T where T: BitStore { type Store = T; fn bits(&self) -> &BitSlice @@ -107,7 +93,7 @@ where T: BitStore { } } -impl Bits for [T] +impl AsBits for [T] where T: BitStore { type Store = T; fn bits(&self) -> &BitSlice @@ -123,7 +109,7 @@ where T: BitStore { macro_rules! impl_bits_for { ($( $n:expr ),* ) => { $( - impl Bits for [T; $n] + impl AsBits for [T; $n] where T: BitStore { type Store = T; fn bits(&self) -> &BitSlice diff --git a/src/lib.rs b/src/lib.rs index 5dec9361..6745b444 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,3 +94,33 @@ fn rca1(a: bool, b: bool, c: bool) -> (bool, bool) { // Split them (yz & 0b01 != 0, yz & 0b10 != 0) } + +/// Old name of the `order` module. +#[deprecated( + since = "0.17.0", + note = "This module was renamed to `order`, and will be removed in the next release." +)] +pub mod cursor { + /// Old name of the `Msb0` type. + #[deprecated( + since = "0.17.0", + note = "This type was renamed to `order::Msb0`, and will be removed in the next release." + )] + pub type BigEndian = crate::order::Msb0; + + /// Old name of the `Lsb0` type. + #[deprecated( + since = "0.17.0", + note = "This type was renamed to `order::Lsb0`, and will be removed in the next release." + )] + pub type LittleEndian = crate::order::Lsb0; + + /// Old name of the `BitOrder` trait. + #[deprecated( + since = "0.17.0", + note = "This trait was renaved to `order::BitOrder`, and will be removed in the next release." + )] + // Silence the lint, as this is a rename rather than a bare trait object. + #[allow(bare_trait_objects)] + pub type Cursor = crate::order::BitOrder; +} diff --git a/src/prelude.rs b/src/prelude.rs index f5a1fa96..4ffe64b0 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -6,7 +6,7 @@ This collects the general public API into a single spot for inclusion, as pub use crate::{ bits, - bits::Bits, + bits::AsBits, fields::BitField, order::{ BitOrder, @@ -28,3 +28,6 @@ pub use crate::{ boxed::BitBox, vec::BitVec, }; + +#[allow(deprecated)] +pub use crate::cursor::*; diff --git a/src/slice/tests.rs b/src/slice/tests.rs index 0a684bbe..9ceb9f20 100644 --- a/src/slice/tests.rs +++ b/src/slice/tests.rs @@ -4,7 +4,7 @@ use super::*; use crate::{ - bits::Bits, + bits::AsBits, order::Msb0, }; diff --git a/src/slice/traits.rs b/src/slice/traits.rs index 5d34c610..e3bccbc6 100644 --- a/src/slice/traits.rs +++ b/src/slice/traits.rs @@ -433,7 +433,7 @@ where O: BitOrder, T: BitStore {} #[cfg(all(test, feature = "alloc"))] mod tests { use crate::{ - bits::Bits, + bits::AsBits, order::Msb0, };