Skip to content

Commit 532d0e1

Browse files
committed
release 1.0.0
1 parent e619e9e commit 532d0e1

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cbor4ii"
3-
version = "0.3.3"
3+
version = "1.0.0"
44
authors = ["quininer <quininer@live.com>"]
55
description = "CBOR: Concise Binary Object Representation"
66
repository = "https://github.com/quininer/cbor4ii"
@@ -10,7 +10,7 @@ license = "MIT"
1010
edition = "2018"
1111

1212
[features]
13-
use_std = [ "serde/std", "use_alloc" ]
13+
use_std = [ "use_alloc" ]
1414
use_alloc = []
1515
half-f16 = [ "half" ]
1616
serde1 = [ "serde", "use_alloc" ]
@@ -35,8 +35,10 @@ all-features = true
3535
name = "ser"
3636
path = "benches/bench_ser.rs"
3737
harness = false
38+
required-features = [ "serde1", "use_std" ]
3839

3940
[[bench]]
4041
name = "de"
4142
path = "benches/bench_de.rs"
4243
harness = false
44+
required-features = [ "serde1" ]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ This library is intended to be compatible with `serde_cbor`,
2424
but will not follow some unreasonable designs of `serde_cbor`.
2525

2626
* `cbor4ii` will express the unit type as an empty array instead of null.
27-
This avoids the problem that `serde_cbor` cannot distinguish between `None` and `Some(())`.
28-
see <https://github.com/pyfisch/cbor/issues/185>
27+
This avoids the problem that `serde_cbor` cannot distinguish between `None` and `Some(())`.
28+
see <https://github.com/pyfisch/cbor/issues/185>
2929
* `cbor4ii` does not support packed mode, and it may be implemented in future,
30-
but it may not be compatible with `serde_cbor`.
31-
If you want packed mode, you should look at `bincode`.
30+
but it may not be compatible with `serde_cbor`.
31+
If you want packed mode, you should look at `bincode`.
3232

3333
## Performance
3434

src/core/dec.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ use crate::alloc::{ vec::Vec, string::String };
1515
/// but can define its own error types, and can get a
1616
/// reference with a long enough lifetime to implement zero-copy decode.
1717
pub trait Read<'de> {
18-
#[cfg(feature = "use_std")]
19-
type Error: std::error::Error + 'static;
20-
21-
#[cfg(not(feature = "use_std"))]
22-
type Error: core::fmt::Display + core::fmt::Debug;
18+
type Error: core::error::Error + 'static;
2319

2420
/// Returns the available bytes.
2521
///
@@ -86,7 +82,7 @@ impl<'de, 'short> Reference<'de, 'short> {
8682
}
8783
}
8884

89-
impl<'a, 'de, T: Read<'de>> Read<'de> for &'a mut T {
85+
impl<'de, T: Read<'de>> Read<'de> for &mut T {
9086
type Error = T::Error;
9187

9288
#[inline]
@@ -116,7 +112,7 @@ pub(crate) fn peek_one<'de, R: Read<'de>>(name: error::StaticStr, reader: &mut R
116112
{
117113
let b = reader.fill(1)?
118114
.as_ref()
119-
.get(0)
115+
.first()
120116
.copied()
121117
.ok_or_else(|| Error::eof(name, 1))?;
122118
Ok(b)

src/core/enc.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ pub use crate::core::error::EncodeError as Error;
1010
/// This is similar to `Write` of standard library,
1111
/// but it can define its own error type and work in `no_std`.
1212
pub trait Write {
13-
#[cfg(feature = "use_std")]
14-
type Error: std::error::Error + 'static;
15-
16-
#[cfg(not(feature = "use_std"))]
17-
type Error: core::fmt::Display + core::fmt::Debug;
13+
type Error: core::error::Error + 'static;
1814

1915
/// write all data
2016
fn push(&mut self, input: &[u8]) -> Result<(), Self::Error>;
@@ -33,7 +29,7 @@ impl<T: Encode> Encode for &'_ T {
3329
}
3430
}
3531

36-
impl<'a, T: Write> Write for &'a mut T {
32+
impl<T: Write> Write for &mut T {
3733
type Error = T::Error;
3834

3935
#[inline]

src/core/raw_value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ where R: dec::Read<'de>
2525
}
2626
}
2727

28-
impl<'r, 'de, R> dec::Read<'de> for RawValueReader<'r, 'de, R>
28+
impl<'de, R> dec::Read<'de> for RawValueReader<'_, 'de, R>
2929
where R: dec::Read<'de>
3030
{
3131
type Error = R::Error;
@@ -84,7 +84,7 @@ impl<'de> dec::Decode<'de> for RawValue<'de> {
8484
}
8585
}
8686

87-
impl<'de> enc::Encode for RawValue<'de> {
87+
impl enc::Encode for RawValue<'_> {
8888
#[inline]
8989
fn encode<W: enc::Write>(&self, writer: &mut W) -> Result<(), enc::Error<W::Error>> {
9090
writer.push(self.0).map_err(enc::Error::Write)

0 commit comments

Comments
 (0)