Skip to content

Commit

Permalink
Split ByteSlice and SplitByteSlice (#991)
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
joshlf committed Mar 1, 2024
1 parent 1bf6212 commit 184dedf
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 89 deletions.
6 changes: 3 additions & 3 deletions src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//!
//! ```rust,edition2021
//! # #[cfg(feature = "derive")] { // This example uses derives, and won't compile without them
//! use zerocopy::{IntoBytes, ByteSlice, FromBytes, KnownLayout, NoCell, Ref, Unaligned};
//! use zerocopy::{IntoBytes, FromBytes, KnownLayout, NoCell, Ref, SplitByteSlice, Unaligned};
//! use zerocopy::byteorder::network_endian::U16;
//!
//! #[derive(FromBytes, IntoBytes, KnownLayout, NoCell, Unaligned)]
Expand All @@ -47,12 +47,12 @@
//! checksum: U16,
//! }
//!
//! struct UdpPacket<B: ByteSlice> {
//! struct UdpPacket<B> {
//! header: Ref<B, UdpHeader>,
//! body: B,
//! }
//!
//! impl<B: ByteSlice> UdpPacket<B> {
//! impl<B: SplitByteSlice> UdpPacket<B> {
//! fn parse(bytes: B) -> Option<UdpPacket<B>> {
//! let (header, body) = Ref::new_from_prefix(bytes)?;
//! Some(UdpPacket { header, body })
Expand Down
Loading

0 comments on commit 184dedf

Please sign in to comment.