From c1934749566c1421aad6c8dd512474f258e07572 Mon Sep 17 00:00:00 2001 From: ciffelia <15273128+ciffelia@users.noreply.github.com> Date: Sun, 14 Apr 2024 18:23:48 +0900 Subject: [PATCH] perf: add `#[inline]` attributes --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d74d006..e27bbd1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -237,6 +237,7 @@ impl Nanoid { /// let id: Nanoid = Nanoid::new_with(rand::thread_rng()); /// ``` #[must_use] + #[inline] pub fn new_with(mut rng: impl rand::Rng) -> Self { // SAFETY: The `assume_init` is safe because the type we are claiming to have initialized // here is a bunch of `MaybeUninit`s, which do not require initialization. @@ -308,6 +309,7 @@ impl Nanoid { /// let id: Nanoid = Nanoid::try_from_bytes(b"0tY_GxufiwmAxvmHR7G0R")?; /// # Ok::<(), Box>(()) /// ``` + #[inline] pub const fn try_from_bytes(buf: &[u8; N]) -> Result { let mut i = 0; while i < N {