diff --git a/ciborium-ll/src/enc.rs b/ciborium-ll/src/enc.rs index 660f96e..5b30f69 100644 --- a/ciborium-ll/src/enc.rs +++ b/ciborium-ll/src/enc.rs @@ -18,10 +18,12 @@ impl From for Encoder { impl Write for Encoder { type Error = W::Error; + #[inline] fn write_all(&mut self, data: &[u8]) -> Result<(), Self::Error> { self.0.write_all(data) } + #[inline] fn flush(&mut self) -> Result<(), Self::Error> { self.0.flush() } @@ -29,12 +31,13 @@ impl Write for Encoder { impl Encoder { /// Unwraps the `Write`, consuming the `Encoder`. + #[inline] pub fn into_inner(self) -> W { self.0 } /// Push a `Header` to the wire - #[inline] + #[inline(always)] pub fn push(&mut self, header: Header) -> Result<(), W::Error> { let title = Title::from(header); diff --git a/ciborium-ll/src/hdr.rs b/ciborium-ll/src/hdr.rs index dec1788..b6dcac2 100644 --- a/ciborium-ll/src/hdr.rs +++ b/ciborium-ll/src/hdr.rs @@ -75,6 +75,7 @@ pub enum Header { impl TryFrom for Header { type Error = InvalidError; + #[inline] fn try_from(title: Title) -> Result<Self, Self::Error> { let opt = |minor| { Some(match minor { @@ -116,6 +117,7 @@ impl TryFrom<Title> for Header { } impl From<Header> for Title { + #[inline(always)] fn from(header: Header) -> Self { let int = |i: u64| match i { x if x <= 23 => Minor::This(i as u8),