Skip to content

Commit

Permalink
Add inline hint to methods that defer to the view
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Feb 26, 2024
1 parent 8fa2c10 commit a39a627
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ impl<const N: usize> String<N> {
/// let s: String<12> = String::try_from("Hello").unwrap();
/// let view: &StringView = &s;
/// ```
#[inline]
pub fn as_view(&self) -> &StringView {
self
}
Expand All @@ -128,6 +129,7 @@ impl<const N: usize> String<N> {
/// let mut s: String<12> = String::try_from("Hello").unwrap();
/// let view: &mut StringView = &mut s;
/// ```
#[inline]
pub fn as_mut_view(&mut self) -> &mut StringView {
self
}
Expand Down Expand Up @@ -352,6 +354,7 @@ impl<const N: usize> String<N> {
/// assert_eq!(s, "olleh");
/// # Ok::<(), ()>(())
/// ```
#[inline]
pub unsafe fn as_mut_vec_view(&mut self) -> &mut VecView<u8> {
self.as_mut_view().as_mut_vec_view()
}
Expand Down

0 comments on commit a39a627

Please sign in to comment.