Skip to content

Commit

Permalink
Implement conversions from reference to Slice1.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Jun 17, 2024
1 parent 4ae473b commit 990118c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/slice1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,13 @@ where
}
}

pub fn from_ref<T>(item: &T) -> &Slice1<T> {
Slice1::from_slice_unchecked(slice::from_ref(item))
}

pub fn from_mut<T>(item: &mut T) -> &mut Slice1<T> {
Slice1::from_mut_slice_unchecked(slice::from_mut(item))
}

#[cfg(test)]
mod tests {}

0 comments on commit 990118c

Please sign in to comment.