Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed May 2, 2024
1 parent f6beda4 commit 151540c
Show file tree
Hide file tree
Showing 8 changed files with 881 additions and 289 deletions.
2 changes: 1 addition & 1 deletion src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//!
//! impl<B: SplitByteSlice> UdpPacket<B> {
//! fn parse(bytes: B) -> Option<UdpPacket<B>> {
//! let (header, body) = Ref::new_from_prefix(bytes)?;
//! let (header, body) = Ref::new_from_prefix(bytes).ok()?;
//! Some(UdpPacket { header, body })
//! }
//!
Expand Down
12 changes: 6 additions & 6 deletions src/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ where
#[doc(hidden)]
#[inline]
pub fn new_slice(bytes: B) -> Option<Ref<B, [T]>> {
Self::new(bytes)
Self::new(bytes).ok()
}
}

Expand All @@ -34,7 +34,7 @@ where
#[doc(hidden)]
#[inline(always)]
pub fn new_slice_unaligned(bytes: B) -> Option<Ref<B, [T]>> {
Ref::new_unaligned(bytes)
Ref::new_unaligned(bytes).ok()
}
}

Expand Down Expand Up @@ -74,15 +74,15 @@ where
#[doc(hidden)]
#[inline]
pub fn new_slice_from_prefix(bytes: B, count: usize) -> Option<(Ref<B, [T]>, B)> {
Ref::with_trailing_elements_from_prefix(bytes, count)
Ref::with_trailing_elements_from_prefix(bytes, count).ok()
}

#[deprecated(since = "0.8.0", note = "replaced by `Ref::with_trailing_elements_from_suffix`")]
#[must_use = "has no side effects"]
#[doc(hidden)]
#[inline]
pub fn new_slice_from_suffix(bytes: B, count: usize) -> Option<(B, Ref<B, [T]>)> {
Ref::with_trailing_elements_from_suffix(bytes, count)
Ref::with_trailing_elements_from_suffix(bytes, count).ok()
}
}

Expand All @@ -99,7 +99,7 @@ where
#[must_use = "has no side effects"]
#[inline(always)]
pub fn new_slice_unaligned_from_prefix(bytes: B, count: usize) -> Option<(Ref<B, [T]>, B)> {
Ref::with_trailing_elements_unaligned_from_prefix(bytes, count)
Ref::with_trailing_elements_unaligned_from_prefix(bytes, count).ok()
}

#[deprecated(
Expand All @@ -110,6 +110,6 @@ where
#[must_use = "has no side effects"]
#[inline(always)]
pub fn new_slice_unaligned_from_suffix(bytes: B, count: usize) -> Option<(B, Ref<B, [T]>)> {
Ref::with_trailing_elements_unaligned_from_suffix(bytes, count)
Ref::with_trailing_elements_unaligned_from_suffix(bytes, count).ok()
}
}
Loading

0 comments on commit 151540c

Please sign in to comment.