"std::time::SystemTime" => Some("u64"),
"std::io::Error" => Some("crate::c_types::IOError"),
+ "core::convert::Infallible" => Some("crate::c_types::NotConstructable"),
+
"bech32::u5" => Some("crate::c_types::u5"),
"core::num::NonZeroU8" => Some("u8"),
// Note that we'll panic for String if is_ref, as we only have non-owned memory, we
// cannot create a &String.
+ "core::convert::Infallible" => Some("panic!(\"You must never construct a NotConstructable! : "),
+
"std::time::Duration"|"core::time::Duration" => Some("std::time::Duration::from_secs("),
"std::time::SystemTime" => Some("(::std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs("),
"alloc::string::String"|"String" => Some(".into_string()"),
"std::io::Error" if !is_ref => Some(".to_rust()"),
+ "core::convert::Infallible" => Some("\")"),
+
"std::time::Duration"|"core::time::Duration" => Some(")"),
"std::time::SystemTime" => Some("))"),
"std::time::SystemTime" => Some(""),
"std::io::Error" if !is_ref => Some("crate::c_types::IOError::from_rust("),
+ "core::convert::Infallible" => Some("panic!(\"Cannot construct an Infallible: "),
+
"bech32::u5" => Some(""),
"bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
"std::time::SystemTime" => Some(".duration_since(::std::time::SystemTime::UNIX_EPOCH).expect(\"Times must be post-1970\").as_secs()"),
"std::io::Error" if !is_ref => Some(")"),
+ "core::convert::Infallible" => Some("\")"),
+
"bech32::u5" => Some(".into()"),
"bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
use std::io::{Cursor, Read}; // TODO: We should use core2 here when we support no_std
+#[repr(C)]
+/// A dummy struct of which an instance must never exist.
+/// This corresponds to the Rust type `Infallible`, or, in unstable rust, `!`
+pub struct NotConstructable {
+ _priv_thing: core::convert::Infallible,
+}
+impl From<core::convert::Infallible> for NotConstructable {
+ fn from(_: core::convert::Infallible) -> Self { unreachable!(); }
+}
+
/// Integer in the range `0..32`
#[derive(PartialEq, Eq, Copy, Clone)]
#[allow(non_camel_case_types)]