]> git.nega.tv - josh/narcissus/commitdiff
Fix doctests
authorJoshua Simmons <josh@nega.tv>
Sat, 18 Feb 2023 13:45:07 +0000 (14:45 +0100)
committerJoshua Simmons <josh@nega.tv>
Sat, 18 Feb 2023 13:45:07 +0000 (14:45 +0100)
narcissus-core/src/blake3/constant_time_eq.rs
narcissus-core/src/blake3/mod.rs
narcissus-core/src/slice.rs

index 7710a185e72ac218c7afea650c4a1841fd45ee9d..bb2f308ed88edf2adef506508a254d8dc4b98b03 100644 (file)
@@ -62,7 +62,7 @@ fn constant_time_ne(a: &[u8], b: &[u8]) -> u8 {
 /// # Examples
 ///
 /// ```
-/// use constant_time_eq::constant_time_eq;
+/// use narcissus_core::blake3::constant_time_eq::constant_time_eq;
 ///
 /// assert!(constant_time_eq(b"foo", b"foo"));
 /// assert!(!constant_time_eq(b"foo", b"bar"));
@@ -95,7 +95,7 @@ fn constant_time_ne_n<const N: usize>(a: &[u8; N], b: &[u8; N]) -> u8 {
 /// # Examples
 ///
 /// ```
-/// use constant_time_eq::constant_time_eq_n;
+/// use narcissus_core::blake3::constant_time_eq::constant_time_eq_n;
 ///
 /// assert!(constant_time_eq_n(&[3; 20], &[3; 20]));
 /// assert!(!constant_time_eq_n(&[3; 20], &[7; 20]));
@@ -112,7 +112,7 @@ pub fn constant_time_eq_n<const N: usize>(a: &[u8; N], b: &[u8; N]) -> bool {
 /// # Examples
 ///
 /// ```
-/// use constant_time_eq::constant_time_eq_16;
+/// use narcissus_core::blake3::constant_time_eq::constant_time_eq_16;
 ///
 /// assert!(constant_time_eq_16(&[3; 16], &[3; 16]));
 /// assert!(!constant_time_eq_16(&[3; 16], &[7; 16]));
@@ -127,7 +127,7 @@ pub fn constant_time_eq_16(a: &[u8; 16], b: &[u8; 16]) -> bool {
 /// # Examples
 ///
 /// ```
-/// use constant_time_eq::constant_time_eq_32;
+/// use narcissus_core::blake3::constant_time_eq::constant_time_eq_32;
 ///
 /// assert!(constant_time_eq_32(&[3; 32], &[3; 32]));
 /// assert!(!constant_time_eq_32(&[3; 32], &[7; 32]));
@@ -142,7 +142,7 @@ pub fn constant_time_eq_32(a: &[u8; 32], b: &[u8; 32]) -> bool {
 /// # Examples
 ///
 /// ```
-/// use constant_time_eq::constant_time_eq_64;
+/// use narcissus_core::blake3::constant_time_eq::constant_time_eq_64;
 ///
 /// assert!(constant_time_eq_64(&[3; 64], &[3; 64]));
 /// assert!(!constant_time_eq_64(&[3; 64], &[7; 64]));
index 6971b008c41da2427b6d0cb29c6706f2088a57ce..35a85fbbaf7daefb43f13410fb9b72de777ee6d1 100644 (file)
@@ -6,18 +6,15 @@
 //! ```
 //! # fn main() -> Result<(), Box<dyn std::error::Error>> {
 //! // Hash an input all at once.
-//! let hash1 = blake3::hash(b"foobarbaz");
+//! let hash1 = narcissus_core::blake3::hash(b"foobarbaz");
 //!
 //! // Hash an input incrementally.
-//! let mut hasher = blake3::Hasher::new();
+//! let mut hasher = narcissus_core::blake3::Hasher::new();
 //! hasher.update(b"foo");
 //! hasher.update(b"bar");
 //! hasher.update(b"baz");
 //! let hash2 = hasher.finalize();
 //! assert_eq!(hash1, hash2);
-//!
-//! // Print a hash as hex.
-//! println!("{}", hash1);
 //! # Ok(())
 //! # }
 //! ```
@@ -753,11 +750,11 @@ fn parent_node_output(
 /// ```
 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
 /// // Hash an input incrementally.
-/// let mut hasher = blake3::Hasher::new();
+/// let mut hasher = narcissus_core::blake3::Hasher::new();
 /// hasher.update(b"foo");
 /// hasher.update(b"bar");
 /// hasher.update(b"baz");
-/// assert_eq!(hasher.finalize(), blake3::hash(b"foobarbaz"));
+/// assert_eq!(hasher.finalize(), narcissus_core::blake3::hash(b"foobarbaz"));
 ///
 /// # Ok(())
 /// # }
index 36ed81b8805f030e18a4b9459e73834c087bdb03..5c469a41c36e7a74886763561b0abbb06684d68c 100644 (file)
@@ -466,32 +466,6 @@ pub fn as_chunks_mut<T, const N: usize>(slice: &mut [T]) -> (&mut [[T; N]], &mut
 /// # Panics
 ///
 /// Panics if `N > len`.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(split_array)]
-///
-/// let v = &[1, 2, 3, 4, 5, 6][..];
-///
-/// {
-///    let (left, right) = v.split_array_ref::<0>();
-///    assert_eq!(left, &[]);
-///    assert_eq!(right, [1, 2, 3, 4, 5, 6]);
-/// }
-///
-/// {
-///     let (left, right) = v.split_array_ref::<2>();
-///     assert_eq!(left, &[1, 2]);
-///     assert_eq!(right, [3, 4, 5, 6]);
-/// }
-///
-/// {
-///     let (left, right) = v.split_array_ref::<6>();
-///     assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
-///     assert_eq!(right, []);
-/// }
-/// ```
 #[inline]
 #[track_caller]
 #[must_use]
@@ -510,20 +484,6 @@ pub fn split_array_ref<T, const N: usize>(slice: &[T]) -> (&[T; N], &[T]) {
 /// # Panics
 ///
 /// Panics if `N > len`.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(split_array)]
-///
-/// let mut v = &mut [1, 0, 3, 0, 5, 6][..];
-/// let (left, right) = v.split_array_mut::<2>();
-/// assert_eq!(left, &mut [1, 0]);
-/// assert_eq!(right, [3, 0, 5, 6]);
-/// left[1] = 2;
-/// right[1] = 4;
-/// assert_eq!(v, [1, 2, 3, 4, 5, 6]);
-/// ```
 #[inline]
 #[track_caller]
 #[must_use]
@@ -543,32 +503,6 @@ pub fn split_array_mut<T, const N: usize>(slice: &mut [T]) -> (&mut [T; N], &mut
 /// # Panics
 ///
 /// Panics if `N > len`.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(split_array)]
-///
-/// let v = &[1, 2, 3, 4, 5, 6][..];
-///
-/// {
-///    let (left, right) = v.rsplit_array_ref::<0>();
-///    assert_eq!(left, [1, 2, 3, 4, 5, 6]);
-///    assert_eq!(right, &[]);
-/// }
-///
-/// {
-///     let (left, right) = v.rsplit_array_ref::<2>();
-///     assert_eq!(left, [1, 2, 3, 4]);
-///     assert_eq!(right, &[5, 6]);
-/// }
-///
-/// {
-///     let (left, right) = v.rsplit_array_ref::<6>();
-///     assert_eq!(left, []);
-///     assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
-/// }
-/// ```
 #[inline]
 #[must_use]
 pub fn rsplit_array_ref<T, const N: usize>(slice: &[T]) -> (&[T], &[T; N]) {
@@ -588,20 +522,6 @@ pub fn rsplit_array_ref<T, const N: usize>(slice: &[T]) -> (&[T], &[T; N]) {
 /// # Panics
 ///
 /// Panics if `N > len`.
-///
-/// # Examples
-///
-/// ```
-/// #![feature(split_array)]
-///
-/// let mut v = &mut [1, 0, 3, 0, 5, 6][..];
-/// let (left, right) = v.rsplit_array_mut::<4>();
-/// assert_eq!(left, [1, 0]);
-/// assert_eq!(right, &mut [3, 0, 5, 6]);
-/// left[1] = 2;
-/// right[1] = 4;
-/// assert_eq!(v, [1, 2, 3, 4, 5, 6]);
-/// ```
 #[inline]
 #[must_use]
 pub fn rsplit_array_mut<T, const N: usize>(slice: &mut [T]) -> (&mut [T], &mut [T; N]) {