use alloc::borrow::ToOwned;
use core::ffi::c_void;
-#[cfg(feature = "std")]
+#[cfg(not(feature = "no-std"))]
pub(crate) use std::io::{self, Cursor, Read};
#[cfg(feature = "no-std")]
pub(crate) use core2::io::{self, Cursor, Read};
-#[cfg(feature = "no-std")]
use alloc::{boxed::Box, vec::Vec, string::String};
use core::convert::TryFrom;
pub extern "C" fn BigEndianScalar_new(big_endian_bytes: ThirtyTwoBytes) -> BigEndianScalar {
BigEndianScalar { big_endian_bytes: big_endian_bytes.data }
}
+#[no_mangle]
+/// Creates a new BigEndianScalar which has the same data as `orig`
+pub extern "C" fn BigEndianScalar_clone(orig: &BigEndianScalar) -> BigEndianScalar { orig.clone() }
#[repr(C)]
#[derive(Copy, Clone)]
pub data: [u8; 32],
}
+#[derive(Clone)]
#[repr(C)]
/// A 3-byte byte array.
pub struct ThreeBytes { /** The three bytes */ pub data: [u8; 3], }
};
String::from_utf8(bytes).unwrap()
}
- #[cfg(feature = "std")]
+ #[cfg(not(feature = "no-std"))]
pub(crate) fn into_pathbuf(mut self) -> std::path::PathBuf {
std::path::PathBuf::from(self.into_string())
}
Str { chars: s.as_ptr(), len: s.len(), chars_is_owned: true }
}
}
-#[cfg(feature = "std")]
+#[cfg(not(feature = "no-std"))]
impl Into<Str> for std::path::PathBuf {
fn into(self) -> Str {
self.into_os_string().into_string().expect("We expect paths to be UTF-8 valid").into()