From 15da1bfd508bc3fed6afc6189699dea7f96c35ed Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 2 Nov 2021 18:11:15 -0700 Subject: [PATCH 1/6] Added no_std feature --- Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 7c2f62d..b8c5af9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,11 @@ repository = "https://github.com/TimelyDataflow/abomonation.git" keywords = ["abomonation"] license = "MIT" +[dependencies] +genio = { version = "0.2.1", optional = true } + [dev-dependencies] recycler="0.1.4" + +[features] +no_std = ["genio"] \ No newline at end of file From 6e0a84c9bc3914e890ba350e0f67bac8246acdf6 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 2 Nov 2021 19:18:20 -0700 Subject: [PATCH 2/6] Error handling for no_std does not work yet, but added no_std feature and dependencies --- Cargo.toml | 4 +- src/abomonated.rs | 17 +++++++-- src/lib.rs | 95 ++++++++++++++++++++++++++++++++++------------- 3 files changed, 87 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8c5af9..42b4441 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,9 +14,11 @@ license = "MIT" [dependencies] genio = { version = "0.2.1", optional = true } +smoltcp = { version = "0.7.1", default-features = false, features = [ "alloc", "log", "proto-ipv4", "proto-ipv6", "proto-igmp", "proto-dhcpv4", "socket-raw", "socket-icmp", "socket-udp", "socket-tcp" ], optional = true } [dev-dependencies] recycler="0.1.4" [features] -no_std = ["genio"] \ No newline at end of file +default = [] +no_std = ["genio", "smoltcp"] \ No newline at end of file diff --git a/src/abomonated.rs b/src/abomonated.rs index 328b195..651ab25 100644 --- a/src/abomonated.rs +++ b/src/abomonated.rs @@ -1,7 +1,18 @@ +#![cfg_attr(feature = "no_std", no_std)] -use std::mem::transmute; -use std::marker::PhantomData; -use std::ops::{Deref, DerefMut}; +#[cfg(not(feature="no_std"))] +use { + std::mem::transmute, + std::marker::PhantomData, + std::ops::{Deref, DerefMut}, +}; + +#[cfg(feature="no_std")] +use { + core::mem::transmute, + core::marker::PhantomData, + core::ops::{Deref, DerefMut}, +}; use super::{Abomonation, decode}; diff --git a/src/lib.rs b/src/lib.rs index 016bcc8..8f99b81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,11 +35,46 @@ //! } //! ``` -use std::mem; // yup, used pretty much everywhere. -use std::io::Write; // for bytes.write_all; push_all is unstable and extend is slow. -use std::io::Result as IOResult; -use std::marker::PhantomData; -use std::num::*; +#![cfg_attr(feature = "no_std", no_std)] + +#[cfg(feature="no_std")] +extern crate genio; + +#[cfg(feature="no_std")] +extern crate smoltcp; + +#[cfg(feature="no_std")] +extern crate alloc; + +#[cfg(not(feature="no_std"))] +use { + std::mem as mem, // yup, used pretty much everywhere. + std::io::{Write, Error}, // for bytes.write_all; push_all is unstable and extend is slow. + std::result::Result, + std::marker::PhantomData, + std::num::*, + std::slice as slice, + std::time::Duration, + std::ops::Range, + std::ptr::write as ptr_write, +}; + +#[cfg(feature="no_std")] +use { + core::mem as mem, + genio::Write, + core::result::Result, + core::marker::PhantomData, + core::num::*, + core::slice as slice, + core::time::Duration, + core::ops::Range, + core::ptr::write as ptr_write, + + alloc::vec::Vec, + alloc::boxed::Box, + alloc::string::String, +}; pub mod abomonated; @@ -71,8 +106,8 @@ pub mod abomonated; /// ``` /// #[inline] -pub unsafe fn encode(typed: &T, write: &mut W) -> IOResult<()> { - let slice = std::slice::from_raw_parts(mem::transmute(typed), mem::size_of::()); +pub unsafe fn encode(typed: &T, write: &mut W) -> Result<(), Error> { + let slice = slice::from_raw_parts(mem::transmute(typed), mem::size_of::()); write.write_all(slice)?; typed.entomb(write)?; Ok(()) @@ -163,7 +198,7 @@ pub trait Abomonation { /// /// Most commonly this is owned data on the other end of pointers in `&self`. The return value /// reports any failures in writing to `write`. - #[inline(always)] unsafe fn entomb(&self, _write: &mut W) -> IOResult<()> { Ok(()) } + #[inline(always)] unsafe fn entomb(&self, _write: &mut W) -> Result<(), Error> { Ok(()) } /// Recover any information for `&mut self` not evident from its binary representation. /// @@ -223,7 +258,7 @@ macro_rules! unsafe_abomonate { }; ($t:ty : $($field:ident),*) => { impl Abomonation for $t { - #[inline] unsafe fn entomb(&self, write: &mut W) -> ::std::io::Result<()> { + #[inline] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { $( self.$field.entomb(write)?; )* Ok(()) } @@ -245,7 +280,7 @@ macro_rules! tuple_abomonate { ( $($name:ident)+) => ( impl<$($name: Abomonation),*> Abomonation for ($($name,)*) { #[allow(non_snake_case)] - #[inline(always)] unsafe fn entomb(&self, write: &mut WRITE) -> IOResult<()> { + #[inline(always)] unsafe fn entomb(&self, write: &mut WRITE) -> Result<(), Error> { let ($(ref $name,)*) = *self; $($name.entomb(write)?;)* Ok(()) @@ -303,12 +338,12 @@ impl Abomonation for () { } impl Abomonation for char { } -impl Abomonation for ::std::time::Duration { } +impl Abomonation for Duration { } impl Abomonation for PhantomData {} -impl Abomonation for std::ops::Range { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { +impl Abomonation for Range { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { self.start.entomb(write)?; self.end.entomb(write)?; Ok(()) @@ -324,7 +359,7 @@ impl Abomonation for std::ops::Range { } impl Abomonation for Option { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { if let &Some(ref inner) = self { inner.entomb(write)?; } @@ -342,7 +377,7 @@ impl Abomonation for Option { } impl Abomonation for Result { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { match self { &Ok(ref inner) => inner.entomb(write)?, &Err(ref inner) => inner.entomb(write)?, @@ -401,7 +436,7 @@ macro_rules! array_abomonate { ($size:expr) => ( impl Abomonation for [T; $size] { #[inline(always)] - unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { + unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { for element in self { element.entomb(write)?; } Ok(()) } @@ -459,7 +494,7 @@ array_abomonate!(32); impl Abomonation for String { #[inline] - unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { + unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { write.write_all(self.as_bytes())?; Ok(()) } @@ -468,7 +503,7 @@ impl Abomonation for String { if self.len() > bytes.len() { None } else { let (mine, rest) = bytes.split_at_mut(self.len()); - std::ptr::write(self, String::from_raw_parts(mem::transmute(mine.as_ptr()), self.len(), self.len())); + ptr_write(self, String::from_raw_parts(mem::transmute(mine.as_ptr()), self.len(), self.len())); Some(rest) } } @@ -479,7 +514,7 @@ impl Abomonation for String { impl Abomonation for Vec { #[inline] - unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { + unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { write.write_all(typed_to_bytes(&self[..]))?; for element in self.iter() { element.entomb(write)?; } Ok(()) @@ -492,8 +527,8 @@ impl Abomonation for Vec { if binary_len > bytes.len() { None } else { let (mine, mut rest) = bytes.split_at_mut(binary_len); - let slice = std::slice::from_raw_parts_mut(mine.as_mut_ptr() as *mut T, self.len()); - std::ptr::write(self, Vec::from_raw_parts(slice.as_mut_ptr(), self.len(), self.len())); + let slice = slice::from_raw_parts_mut(mine.as_mut_ptr() as *mut T, self.len()); + ptr_write(self, Vec::from_raw_parts(slice.as_mut_ptr(), self.len(), self.len())); for element in self.iter_mut() { let temp = rest; // temp variable explains lifetimes (mysterious!) rest = element.exhume(temp)?; @@ -513,8 +548,8 @@ impl Abomonation for Vec { impl Abomonation for Box { #[inline] - unsafe fn entomb(&self, bytes: &mut W) -> IOResult<()> { - bytes.write_all(std::slice::from_raw_parts(mem::transmute(&**self), mem::size_of::()))?; + unsafe fn entomb(&self, bytes: &mut W) -> Result<(), Error> { + bytes.write_all(slice::from_raw_parts(mem::transmute(&**self), mem::size_of::()))?; (**self).entomb(bytes)?; Ok(()) } @@ -524,7 +559,7 @@ impl Abomonation for Box { if binary_len > bytes.len() { None } else { let (mine, mut rest) = bytes.split_at_mut(binary_len); - std::ptr::write(self, mem::transmute(mine.as_mut_ptr() as *mut T)); + ptr_write(self, mem::transmute(mine.as_mut_ptr() as *mut T)); let temp = rest; rest = (**self).exhume(temp)?; Some(rest) } @@ -536,18 +571,28 @@ impl Abomonation for Box { // This method currently enables undefined behavior, by exposing padding bytes. #[inline] unsafe fn typed_to_bytes(slice: &[T]) -> &[u8] { - std::slice::from_raw_parts(slice.as_ptr() as *const u8, slice.len() * mem::size_of::()) + slice::from_raw_parts(slice.as_ptr() as *const u8, slice.len() * mem::size_of::()) } mod network { use Abomonation; + + #[cfg(not(feature="no_std"))] use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6, IpAddr, Ipv4Addr, Ipv6Addr}; + #[cfg(feature="no_std")] + use smoltcp::wire::{IpAddress as IpAddr, Ipv4Address as Ipv4Addr, Ipv6Address as Ipv6Addr}; + impl Abomonation for IpAddr { } impl Abomonation for Ipv4Addr { } impl Abomonation for Ipv6Addr { } + #[cfg(not(feature="no_std"))] impl Abomonation for SocketAddr { } + + #[cfg(not(feature="no_std"))] impl Abomonation for SocketAddrV4 { } + + #[cfg(not(feature="no_std"))] impl Abomonation for SocketAddrV6 { } } From 22a65a62854edfa8590d47a7be5e6eaa0704ebb5 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 15 Nov 2021 09:25:53 -0800 Subject: [PATCH 3/6] Switched from genio to bare_io and everything seems functional --- Cargo.toml | 4 ++-- benches/serde.rs | 15 +++++++++++++++ src/lib.rs | 33 +++++++++++++++++---------------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 42b4441..7f45e74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["abomonation"] license = "MIT" [dependencies] -genio = { version = "0.2.1", optional = true } +bare-io = { version = "0.2.1", default-features = false, features = [ "alloc" ], optional = true } smoltcp = { version = "0.7.1", default-features = false, features = [ "alloc", "log", "proto-ipv4", "proto-ipv6", "proto-igmp", "proto-dhcpv4", "socket-raw", "socket-icmp", "socket-udp", "socket-tcp" ], optional = true } [dev-dependencies] @@ -21,4 +21,4 @@ recycler="0.1.4" [features] default = [] -no_std = ["genio", "smoltcp"] \ No newline at end of file +no_std = ["bare-io", "smoltcp"] diff --git a/benches/serde.rs b/benches/serde.rs index 5965794..cf1dd6d 100644 --- a/benches/serde.rs +++ b/benches/serde.rs @@ -3,9 +3,24 @@ extern crate abomonation; extern crate test; +#[cfg(feature="no_std")] +extern crate bare_io; + use test::Bencher; use abomonation::{Abomonation, encode, decode}; +#[cfg(not(feature="no_std"))] +use { + std::io::Write, + std::io::Result as IOResult, +}; + +#[cfg(feature="no_std")] +use { + bare_io::Write, + bare_io::Result as IOResult, +}; + #[bench] fn bench_populate(b: &mut Bencher) { b.iter(|| { diff --git a/src/lib.rs b/src/lib.rs index 8f99b81..6659b6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ #![cfg_attr(feature = "no_std", no_std)] #[cfg(feature="no_std")] -extern crate genio; +extern crate bare_io; #[cfg(feature="no_std")] extern crate smoltcp; @@ -49,8 +49,8 @@ extern crate alloc; #[cfg(not(feature="no_std"))] use { std::mem as mem, // yup, used pretty much everywhere. - std::io::{Write, Error}, // for bytes.write_all; push_all is unstable and extend is slow. - std::result::Result, + std::io::Write, // for bytes.write_all; push_all is unstable and extend is slow. + std::io::Result as IOResult, std::marker::PhantomData, std::num::*, std::slice as slice, @@ -62,8 +62,6 @@ use { #[cfg(feature="no_std")] use { core::mem as mem, - genio::Write, - core::result::Result, core::marker::PhantomData, core::num::*, core::slice as slice, @@ -71,6 +69,9 @@ use { core::ops::Range, core::ptr::write as ptr_write, + bare_io::Write, + bare_io::Result as IOResult, + alloc::vec::Vec, alloc::boxed::Box, alloc::string::String, @@ -106,7 +107,7 @@ pub mod abomonated; /// ``` /// #[inline] -pub unsafe fn encode(typed: &T, write: &mut W) -> Result<(), Error> { +pub unsafe fn encode(typed: &T, write: &mut W) -> IOResult<()> { let slice = slice::from_raw_parts(mem::transmute(typed), mem::size_of::()); write.write_all(slice)?; typed.entomb(write)?; @@ -198,7 +199,7 @@ pub trait Abomonation { /// /// Most commonly this is owned data on the other end of pointers in `&self`. The return value /// reports any failures in writing to `write`. - #[inline(always)] unsafe fn entomb(&self, _write: &mut W) -> Result<(), Error> { Ok(()) } + #[inline(always)] unsafe fn entomb(&self, _write: &mut W) -> IOResult<()> { Ok(()) } /// Recover any information for `&mut self` not evident from its binary representation. /// @@ -258,7 +259,7 @@ macro_rules! unsafe_abomonate { }; ($t:ty : $($field:ident),*) => { impl Abomonation for $t { - #[inline] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + #[inline] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { $( self.$field.entomb(write)?; )* Ok(()) } @@ -280,7 +281,7 @@ macro_rules! tuple_abomonate { ( $($name:ident)+) => ( impl<$($name: Abomonation),*> Abomonation for ($($name,)*) { #[allow(non_snake_case)] - #[inline(always)] unsafe fn entomb(&self, write: &mut WRITE) -> Result<(), Error> { + #[inline(always)] unsafe fn entomb(&self, write: &mut WRITE) -> IOResult<()> { let ($(ref $name,)*) = *self; $($name.entomb(write)?;)* Ok(()) @@ -343,7 +344,7 @@ impl Abomonation for Duration { } impl Abomonation for PhantomData {} impl Abomonation for Range { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { self.start.entomb(write)?; self.end.entomb(write)?; Ok(()) @@ -359,7 +360,7 @@ impl Abomonation for Range { } impl Abomonation for Option { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { if let &Some(ref inner) = self { inner.entomb(write)?; } @@ -377,7 +378,7 @@ impl Abomonation for Option { } impl Abomonation for Result { - #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + #[inline(always)] unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { match self { &Ok(ref inner) => inner.entomb(write)?, &Err(ref inner) => inner.entomb(write)?, @@ -436,7 +437,7 @@ macro_rules! array_abomonate { ($size:expr) => ( impl Abomonation for [T; $size] { #[inline(always)] - unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { for element in self { element.entomb(write)?; } Ok(()) } @@ -494,7 +495,7 @@ array_abomonate!(32); impl Abomonation for String { #[inline] - unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { write.write_all(self.as_bytes())?; Ok(()) } @@ -514,7 +515,7 @@ impl Abomonation for String { impl Abomonation for Vec { #[inline] - unsafe fn entomb(&self, write: &mut W) -> Result<(), Error> { + unsafe fn entomb(&self, write: &mut W) -> IOResult<()> { write.write_all(typed_to_bytes(&self[..]))?; for element in self.iter() { element.entomb(write)?; } Ok(()) @@ -548,7 +549,7 @@ impl Abomonation for Vec { impl Abomonation for Box { #[inline] - unsafe fn entomb(&self, bytes: &mut W) -> Result<(), Error> { + unsafe fn entomb(&self, bytes: &mut W) -> IOResult<()> { bytes.write_all(slice::from_raw_parts(mem::transmute(&**self), mem::size_of::()))?; (**self).entomb(bytes)?; Ok(()) From 709818ef4c6f633015f4b43ce04f93a6f7891aef Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 15 Nov 2021 09:59:06 -0800 Subject: [PATCH 4/6] Changed from no_std feature to std feature --- Cargo.toml | 8 ++++---- benches/serde.rs | 6 +++--- src/abomonated.rs | 6 +++--- src/lib.rs | 23 +++++++++++------------ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7f45e74..1a686f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,12 @@ keywords = ["abomonation"] license = "MIT" [dependencies] -bare-io = { version = "0.2.1", default-features = false, features = [ "alloc" ], optional = true } -smoltcp = { version = "0.7.1", default-features = false, features = [ "alloc", "log", "proto-ipv4", "proto-ipv6", "proto-igmp", "proto-dhcpv4", "socket-raw", "socket-icmp", "socket-udp", "socket-tcp" ], optional = true } +bare-io = { version = "0.2.1", default-features = false, features = [ "alloc" ] } +smoltcp = { version = "0.7.1", default-features = false, features = [ "alloc", "log", "proto-ipv4", "proto-ipv6", "proto-igmp", "proto-dhcpv4", "socket-raw", "socket-icmp", "socket-udp", "socket-tcp" ] } [dev-dependencies] recycler="0.1.4" [features] -default = [] -no_std = ["bare-io", "smoltcp"] +default = ["std"] +std = [] diff --git a/benches/serde.rs b/benches/serde.rs index cf1dd6d..24cb399 100644 --- a/benches/serde.rs +++ b/benches/serde.rs @@ -3,19 +3,19 @@ extern crate abomonation; extern crate test; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] extern crate bare_io; use test::Bencher; use abomonation::{Abomonation, encode, decode}; -#[cfg(not(feature="no_std"))] +#[cfg(feature="std")] use { std::io::Write, std::io::Result as IOResult, }; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] use { bare_io::Write, bare_io::Result as IOResult, diff --git a/src/abomonated.rs b/src/abomonated.rs index 651ab25..31e3b62 100644 --- a/src/abomonated.rs +++ b/src/abomonated.rs @@ -1,13 +1,13 @@ -#![cfg_attr(feature = "no_std", no_std)] +#![cfg_attr(not(feature = "std"), no_std)] -#[cfg(not(feature="no_std"))] +#[cfg(feature="std")] use { std::mem::transmute, std::marker::PhantomData, std::ops::{Deref, DerefMut}, }; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] use { core::mem::transmute, core::marker::PhantomData, diff --git a/src/lib.rs b/src/lib.rs index 6659b6b..9d04a3d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,19 +34,18 @@ //! assert!(remaining.len() == 0); //! } //! ``` +#![cfg_attr(not(feature="std"), no_std)] -#![cfg_attr(feature = "no_std", no_std)] - -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] extern crate bare_io; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] extern crate smoltcp; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] extern crate alloc; -#[cfg(not(feature="no_std"))] +#[cfg(feature="std")] use { std::mem as mem, // yup, used pretty much everywhere. std::io::Write, // for bytes.write_all; push_all is unstable and extend is slow. @@ -59,7 +58,7 @@ use { std::ptr::write as ptr_write, }; -#[cfg(feature="no_std")] +#[cfg(not(feature="std"))] use { core::mem as mem, core::marker::PhantomData, @@ -578,22 +577,22 @@ impl Abomonation for Box { mod network { use Abomonation; - #[cfg(not(feature="no_std"))] + #[cfg(feature="std")] use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6, IpAddr, Ipv4Addr, Ipv6Addr}; - #[cfg(feature="no_std")] + #[cfg(not(feature="std"))] use smoltcp::wire::{IpAddress as IpAddr, Ipv4Address as Ipv4Addr, Ipv6Address as Ipv6Addr}; impl Abomonation for IpAddr { } impl Abomonation for Ipv4Addr { } impl Abomonation for Ipv6Addr { } - #[cfg(not(feature="no_std"))] + #[cfg(feature="std")] impl Abomonation for SocketAddr { } - #[cfg(not(feature="no_std"))] + #[cfg(feature="std")] impl Abomonation for SocketAddrV4 { } - #[cfg(not(feature="no_std"))] + #[cfg(feature="std")] impl Abomonation for SocketAddrV6 { } } From 568b2d6177e2adce0c719e04ade8aa7f9fb26012 Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Mon, 15 Nov 2021 10:18:03 -0800 Subject: [PATCH 5/6] Removed deprecation warning --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9d04a3d..cf7a88e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -251,7 +251,6 @@ pub trait Abomonation { /// } /// ``` #[macro_export] -#[deprecated(since="0.5", note="please use the abomonation_derive crate")] macro_rules! unsafe_abomonate { ($t:ty) => { impl Abomonation for $t { } From ba32591cdd2a31998f9ffac3c5a9d878b663173d Mon Sep 17 00:00:00 2001 From: Erika Hunhoff Date: Tue, 16 Nov 2021 08:26:56 -0800 Subject: [PATCH 6/6] Updated bare-io to use newer version, core2 --- Cargo.toml | 2 +- benches/serde.rs | 6 +++--- src/lib.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1a686f9..dc529f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["abomonation"] license = "MIT" [dependencies] -bare-io = { version = "0.2.1", default-features = false, features = [ "alloc" ] } +core2 = { version = "0.3", default-features = false, features = [ "alloc" ] } smoltcp = { version = "0.7.1", default-features = false, features = [ "alloc", "log", "proto-ipv4", "proto-ipv6", "proto-igmp", "proto-dhcpv4", "socket-raw", "socket-icmp", "socket-udp", "socket-tcp" ] } [dev-dependencies] diff --git a/benches/serde.rs b/benches/serde.rs index 24cb399..4aad85a 100644 --- a/benches/serde.rs +++ b/benches/serde.rs @@ -4,7 +4,7 @@ extern crate abomonation; extern crate test; #[cfg(not(feature="std"))] -extern crate bare_io; +extern crate core2; use test::Bencher; use abomonation::{Abomonation, encode, decode}; @@ -17,8 +17,8 @@ use { #[cfg(not(feature="std"))] use { - bare_io::Write, - bare_io::Result as IOResult, + core2::io::Write, + core2::io::Result as IOResult, }; #[bench] diff --git a/src/lib.rs b/src/lib.rs index cf7a88e..aab4703 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ #![cfg_attr(not(feature="std"), no_std)] #[cfg(not(feature="std"))] -extern crate bare_io; +extern crate core2; #[cfg(not(feature="std"))] extern crate smoltcp; @@ -68,8 +68,8 @@ use { core::ops::Range, core::ptr::write as ptr_write, - bare_io::Write, - bare_io::Result as IOResult, + core2::io::Write, + core2::io::Result as IOResult, alloc::vec::Vec, alloc::boxed::Box,