Skip to content

Commit

Permalink
perf: add #[inline] attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ciffelia committed Apr 14, 2024
1 parent 8ec2823 commit c193474
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ impl<const N: usize, A: Alphabet> Nanoid<N, A> {
/// 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.
Expand Down Expand Up @@ -308,6 +309,7 @@ impl<const N: usize, A: Alphabet> Nanoid<N, A> {
/// let id: Nanoid = Nanoid::try_from_bytes(b"0tY_GxufiwmAxvmHR7G0R")?;
/// # Ok::<(), Box<dyn std::error::Error>>(())
/// ```
#[inline]
pub const fn try_from_bytes(buf: &[u8; N]) -> Result<Self, ParseError> {
let mut i = 0;
while i < N {
Expand Down

0 comments on commit c193474

Please sign in to comment.