tidecoin_internals/
lib.rs1#![no_std]
9#![warn(missing_docs)]
11#![warn(deprecated_in_future)]
12#![doc(test(attr(warn(unused))))]
13
14#[cfg(feature = "alloc")]
15extern crate alloc;
16
17#[cfg(feature = "std")]
18extern crate std;
19
20#[cfg(feature = "test-serde")]
21pub extern crate serde_json;
22
23#[cfg(feature = "test-serde")]
24pub extern crate bincode;
25
26#[doc(hidden)]
29pub mod rust_version {
30 include!(concat!(env!("OUT_DIR"), "/rust_version.rs"));
31}
32
33#[doc(hidden)]
34pub mod _export {
35 #[cfg(feature = "alloc")]
36 pub extern crate alloc;
37}
38
39pub mod array;
40pub mod array_vec;
41pub mod const_tools;
42pub mod error;
43#[cfg(feature = "hex")]
44pub mod hex;
45pub mod macros;
46mod parse;
47pub mod script;
48pub mod slice;
49pub mod wrap_debug;
50#[cfg(feature = "serde")]
51#[macro_use]
52pub mod serde;
53pub mod const_casts;
54
55pub trait ToU64 {
60 fn to_u64(self) -> u64;
62}
63
64macro_rules! impl_to_u64 {
65 ($($ty:ident),*) => {
66 $(
67 impl ToU64 for $ty { fn to_u64(self) -> u64 { self.into() } }
68 )*
69 }
70}
71impl_to_u64!(u8, u16, u32, u64);
72
73impl ToU64 for usize {
74 fn to_u64(self) -> u64 {
75 crate::const_assert!(
76 core::mem::size_of::<usize>() <= 8;
77 "platforms that have usize larger than 64 bits are not supported"
78 );
79 self as u64
80 }
81}