From ce3830f277fe1c80b98bd38d7f8e5e583051e03e Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 5 Dec 2023 18:32:11 +0000 Subject: [PATCH] Make crate no-std --- src/fingerprint.rs | 12 ++++++------ src/lib.rs | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/fingerprint.rs b/src/fingerprint.rs index e6acfeb..060731d 100644 --- a/src/fingerprint.rs +++ b/src/fingerprint.rs @@ -47,17 +47,17 @@ impl SeedFingerprint { #[test] fn test_seed_fingerprint() { struct TestVector { - root_seed: Vec, - fingerprint: Vec, + root_seed: [u8; 32], + fingerprint: [u8; 32], } - let test_vectors = vec![TestVector { - root_seed: vec![ + let test_vectors = [TestVector { + root_seed: [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, ], - fingerprint: vec![ + fingerprint: [ 0xde, 0xff, 0x60, 0x4c, 0x24, 0x67, 0x10, 0xf7, 0x17, 0x6d, 0xea, 0xd0, 0x2a, 0xa7, 0x46, 0xf2, 0xfd, 0x8d, 0x53, 0x89, 0xf7, 0x7, 0x25, 0x56, 0xdc, 0xb5, 0x55, 0xfd, 0xbe, 0x5e, 0x3a, 0xe3, @@ -71,7 +71,7 @@ fn test_seed_fingerprint() { } #[test] fn test_seed_fingerprint_is_none() { - let odd_seed = vec![ + let odd_seed = [ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, ]; diff --git a/src/lib.rs b/src/lib.rs index 0dc5b44..8caca8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ //! //! [ZIP 32]: https://zips.z.cash/zip-0032 +#![no_std] #![deny(missing_docs)] #![deny(unsafe_code)] #![deny(rustdoc::broken_intra_doc_links)] @@ -121,7 +122,7 @@ impl From for DiversifierIndex { } impl TryFrom for u32 { - type Error = std::num::TryFromIntError; + type Error = core::num::TryFromIntError; fn try_from(di: DiversifierIndex) -> Result { let mut u128_bytes = [0u8; 16];