X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Fc_types%2Fmod.rs;h=e5449a5a934281953c977bd3ddc560e448989ef8;hb=c434cf955420dcbc9788db83ec00be50ce5daa6a;hp=472d4d0d15482e30c031720f0ee4de708d53daef;hpb=1bb5ae1b34aeb74009b7b4b5ebefc957cddc30a6;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index 472d4d0..e5449a5 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -13,9 +13,13 @@ use bitcoin::secp256k1::recovery::RecoveryId; use bitcoin::secp256k1::recovery::RecoverableSignature as SecpRecoverableSignature; use bitcoin::bech32; -use std::convert::TryInto; // Bindings need at least rustc 1.34 +use core::convert::TryInto; // Bindings need at least rustc 1.34 use core::ffi::c_void; -use std::io::{Cursor, Read}; // TODO: We should use core2 here when we support no_std + +#[cfg(feature = "std")] +pub(crate) use std::io::{self, Cursor, Read}; +#[cfg(feature = "no-std")] +pub(crate) use core2::io::{self, Cursor, Read}; #[repr(C)] /// A dummy struct of which an instance must never exist. @@ -417,7 +421,7 @@ pub struct TwentyBytes { /** The twenty bytes */ pub data: [u8; 20], } pub(crate) struct VecWriter(pub Vec); impl lightning::util::ser::Writer for VecWriter { - fn write_all(&mut self, buf: &[u8]) -> Result<(), ::std::io::Error> { + fn write_all(&mut self, buf: &[u8]) -> Result<(), io::Error> { self.0.extend_from_slice(buf); Ok(()) }