Skip to content

Commit fe4e2e2

Browse files
committed
refactor: deprecate into_vec in favour of to_vec
Signed-off-by: Liam Gray <[email protected]>
1 parent 2a3025a commit fe4e2e2

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

.github/workflows/test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- {name: ciborium-ll}
2323
- {name: ciborium}
2424
- {name: ciborium, feat: std}
25-
- {name: ciborium, feat: canonical}
2625
- {name: ciborium-io}
2726
- {name: ciborium-io, feat: alloc}
2827
- {name: ciborium-io, feat: std}

ciborium-ll/src/enc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,26 @@ impl<W: Write> From<W> for Encoder<W> {
1818
impl<W: Write> Write for Encoder<W> {
1919
type Error = W::Error;
2020

21+
#[inline]
2122
fn write_all(&mut self, data: &[u8]) -> Result<(), Self::Error> {
2223
self.0.write_all(data)
2324
}
2425

26+
#[inline]
2527
fn flush(&mut self) -> Result<(), Self::Error> {
2628
self.0.flush()
2729
}
2830
}
2931

3032
impl<W: Write> Encoder<W> {
3133
/// Unwraps the `Write`, consuming the `Encoder`.
34+
#[inline]
3235
pub fn into_inner(self) -> W {
3336
self.0
3437
}
3538

3639
/// Push a `Header` to the wire
37-
#[inline]
40+
#[inline(always)]
3841
pub fn push(&mut self, header: Header) -> Result<(), W::Error> {
3942
let title = Title::from(header);
4043

ciborium-ll/src/hdr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub enum Header {
7575
impl TryFrom<Title> for Header {
7676
type Error = InvalidError;
7777

78+
#[inline]
7879
fn try_from(title: Title) -> Result<Self, Self::Error> {
7980
let opt = |minor| {
8081
Some(match minor {
@@ -116,6 +117,7 @@ impl TryFrom<Title> for Header {
116117
}
117118

118119
impl From<Header> for Title {
120+
#[inline(always)]
119121
fn from(header: Header) -> Self {
120122
let int = |i: u64| match i {
121123
x if x <= 23 => Minor::This(i as u8),

ciborium/src/ser/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use serde::ser::{Error as SerError, StdError};
1010
pub enum Error<T> {
1111
/// An error occurred while writing bytes
1212
///
13-
/// Contains the underlying error reaturned while writing.
13+
/// Contains the underlying error returned while writing.
1414
Io(T),
1515

1616
/// An error indicating a value that cannot be serialized

ciborium/src/ser/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ where
508508
serializer,
509509
collection_type,
510510
length,
511-
tag_written: false,
511+
tag_written: !matches!(collection_type, CollectionType::Tag),
512512
#[cfg(feature = "std")]
513513
cache_keys: Vec::new(),
514514
#[cfg(feature = "std")]
@@ -645,7 +645,7 @@ where
645645
&mut self,
646646
value: &U,
647647
) -> Result<(), Self::Error> {
648-
if self.tag_written || !matches!(self.collection_type, CollectionType::Tag) {
648+
if self.tag_written {
649649
// untagged tuples are CollectionType::Array to skip writing the tag header
650650
return self.inline_serialize_value(value);
651651
}

0 commit comments

Comments
 (0)