+pub mod sign;
+pub mod onion_message;
+pub mod blinded_path;
+pub mod events;
+
+pub(crate) mod crypto;
+
+#[cfg(feature = "std")]
+/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
+pub use std::io;
+#[cfg(not(feature = "std"))]
+/// Re-export of either `core2::io` or `std::io`, depending on the `std` feature flag.
+pub use core2::io;
+
+#[cfg(not(feature = "std"))]
+#[doc(hidden)]
+/// IO utilities public only for use by in-crate macros. These should not be used externally
+pub mod io_extras {
+ use core2::io::{self, Read, Write};
+
+ /// A writer which will move data into the void.
+ pub struct Sink {
+ _priv: (),
+ }
+
+ /// Creates an instance of a writer which will successfully consume all data.
+ pub const fn sink() -> Sink {
+ Sink { _priv: () }
+ }
+
+ impl core2::io::Write for Sink {
+ #[inline]
+ fn write(&mut self, buf: &[u8]) -> core2::io::Result<usize> {
+ Ok(buf.len())
+ }
+
+ #[inline]
+ fn flush(&mut self) -> core2::io::Result<()> {
+ Ok(())
+ }
+ }
+
+ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> Result<u64, io::Error>
+ where
+ R: Read,
+ W: Write,
+ {
+ let mut count = 0;
+ let mut buf = [0u8; 64];
+
+ loop {
+ match reader.read(&mut buf) {
+ Ok(0) => break,
+ Ok(n) => { writer.write_all(&buf[0..n])?; count += n as u64; },
+ Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
+ Err(e) => return Err(e.into()),
+ };
+ }
+ Ok(count)
+ }
+
+ pub fn read_to_end<D: io::Read>(mut d: D) -> Result<alloc::vec::Vec<u8>, io::Error> {
+ let mut result = vec![];
+ let mut buf = [0u8; 64];
+ loop {
+ match d.read(&mut buf) {
+ Ok(0) => break,
+ Ok(n) => result.extend_from_slice(&buf[0..n]),
+ Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
+ Err(e) => return Err(e.into()),
+ };
+ }
+ Ok(result)
+ }
+}
+
+#[cfg(feature = "std")]
+#[doc(hidden)]
+/// IO utilities public only for use by in-crate macros. These should not be used externally
+mod io_extras {
+ pub fn read_to_end<D: ::std::io::Read>(mut d: D) -> Result<Vec<u8>, ::std::io::Error> {
+ let mut buf = Vec::new();
+ d.read_to_end(&mut buf)?;
+ Ok(buf)
+ }
+
+ pub use std::io::{copy, sink};
+}
+
+mod prelude {
+ #[cfg(feature = "hashbrown")]
+ extern crate hashbrown;
+
+ pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};
+ #[cfg(not(feature = "hashbrown"))]
+ pub use std::collections::{HashMap, HashSet, hash_map};
+ #[cfg(feature = "hashbrown")]
+ pub use self::hashbrown::{HashMap, HashSet, hash_map};
+
+ pub use alloc::borrow::ToOwned;
+ pub use alloc::string::ToString;
+}
+
+#[cfg(all(not(ldk_bench), feature = "backtrace", feature = "std", test))]
+extern crate backtrace;
+
+mod sync;