Skip to content

Commit e99a88a

Browse files
authored
chore!: Stabilize API for 1.0.0 (#20)
* chore!: Remove Encoder trait BREAKING-CHANGE: Removes the Encoder trait in favor of ByteEncoder and StrEncoder * chore!: Remove deprecated `Flags` combinator * fix: comment references Encoder::error instead of BaseEncoder::Error
1 parent e0e18c2 commit e99a88a

4 files changed

Lines changed: 1 addition & 169 deletions

File tree

examples/bson.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ where
7373
fn encode(&self, encoder: &mut Encoder) -> Result<(), Self::Error> {
7474
let document = (
7575
Iter::new(&self.e_list),
76-
// u8 uses `Encoder::Error`, so we need to convert it to our BsonError
76+
// u8 uses `BaseEncoder::Error`, so we need to convert it to our BsonError
7777
// for our combinators to work.
7878
FromError::<_, Self::Error>::new(0u8),
7979
);

src/combinators/flags.rs

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/combinators/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ These types are supported when the `bytes` feature is enabled.
8585
)]
8686
mod be;
8787
mod cond;
88-
mod flags;
8988
mod from_error;
9089
mod iter;
9190
mod le;
@@ -94,8 +93,6 @@ mod separated;
9493

9594
pub use be::BE;
9695
pub use cond::Cond;
97-
#[allow(deprecated)]
98-
pub use flags::Flags;
9996
pub use from_error::FromError;
10097
pub use iter::Iter;
10198
pub use le::LE;

src/lib.rs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -184,61 +184,3 @@ where
184184
Ok(encoder.size())
185185
}
186186
}
187-
188-
// TODO: Remove before 1.0.0
189-
190-
/// A type that can handle an [`Encodable`] type
191-
///
192-
/// An encoder is responsible for writing bytes into a buffer or other
193-
/// destination. Encoders are used by encodables to write their data. Thus,
194-
/// encoders must uphold the same properties as encodables.
195-
#[deprecated(
196-
since = "0.2.2",
197-
note = "The `Encoder` trait has been deprecated in favor of multiple encoder traits. Please use `ByteEncoder`, `StrEncoder`, or `BaseEncoder` depending on your needs. The `Encoder` trait will be removed in 1.0.0."
198-
)]
199-
pub trait Encoder {
200-
/// The error type that can be returned when encoding a value.
201-
///
202-
/// For example, some encoders may return an error if the underlying buffer
203-
/// is full
204-
type Error;
205-
206-
/// Copies a slice of bytes into the encoder
207-
///
208-
/// # Errors
209-
///
210-
/// Implementations of this method should return an error if the underlying
211-
/// encoder fails to write the slice of bytes.
212-
fn put_slice(&mut self, slice: &[u8]) -> Result<(), Self::Error>;
213-
/// Appends a single byte into the encoder, if possible.
214-
///
215-
/// # Errors
216-
///
217-
/// Implementations of this method should return an error if the underlying
218-
/// encoder fails to write the byte.
219-
fn put_byte(&mut self, byte: u8) -> Result<(), Self::Error>;
220-
}
221-
222-
#[allow(deprecated)]
223-
impl<T> BaseEncoder for T
224-
where
225-
T: Encoder,
226-
{
227-
type Error = <T as Encoder>::Error;
228-
}
229-
230-
#[allow(deprecated)]
231-
impl<T> ByteEncoder for T
232-
where
233-
T: Encoder,
234-
{
235-
#[inline]
236-
fn put_slice(&mut self, slice: &[u8]) -> Result<(), Self::Error> {
237-
Encoder::put_slice(self, slice)
238-
}
239-
240-
#[inline]
241-
fn put_byte(&mut self, byte: u8) -> Result<(), Self::Error> {
242-
Encoder::put_byte(self, byte)
243-
}
244-
}

0 commit comments

Comments
 (0)