peek_poke

Trait Peek

Source
pub trait Peek: Poke {
    // Required method
    unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8;
}
Expand description

A trait for values that provide deserialization from buffers of bytes.

§Example

use peek_poke::Peek;

struct Bar {
    a: u32,
    b: u8,
    c: i16,
}

...

impl Peek for Bar {
    unsafe fn peek_from(&mut self, bytes: *const u8) -> *const u8 {
        let bytes = self.a.peek_from(bytes);
        let bytes = self.b.peek_from(bytes);
        self.c.peek_from(bytes)
    }
}

§Safety

The Peek trait contains unsafe methods for the following reasons, and implementors must ensure that they adhere to these contracts:

  • Callers of this trait are expected to rely on the contract defined on each method, and implementors must ensure that peek_from() doesn’t read more bytes from bytes than is returned by Peek::max_size().

Required Methods§

Source

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Deserialize from the buffer pointed to by bytes.

Returns a pointer to the next byte after the unconsumed bytes not used to deserialize the representation of Self.

§Safety

This function is unsafe because undefined behavior can result if the caller does not ensure all of the following:

  • bytes must denote a valid pointer to a block of memory.

  • bytes must pointer to at least the number of bytes returned by Poke::max_size().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Peek for bool

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for f32

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for f64

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for i8

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for i16

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for i32

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for i64

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for isize

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for u8

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for u16

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for u32

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for u64

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for ()

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl Peek for usize

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<A: Peek> Peek for (A,)

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<A: Peek, B: Peek> Peek for (A, B)

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<A: Peek, B: Peek, C: Peek> Peek for (A, B, C)

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<A: Peek, B: Peek, C: Peek, D: Peek> Peek for (A, B, C, D)

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<A: Peek, B: Peek, C: Peek, D: Peek, E: Peek> Peek for (A, B, C, D, E)

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T> Peek for PhantomData<T>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Default + Peek> Peek for Option<T>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 1]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 2]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 3]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 4]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 5]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 6]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 7]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 8]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 9]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 10]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 11]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 12]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 13]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 14]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 15]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 16]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 17]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 18]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 19]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 20]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 21]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 22]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 23]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 24]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 25]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 26]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 27]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 28]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 29]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 30]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 31]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek> Peek for [T; 32]

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, S, D> Peek for Transform3D<T, S, D>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for Box2D<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for Point2D<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for Rect<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for SideOffsets2D<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for Size2D<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Source§

impl<T: Peek, U> Peek for Vector2D<T, U>

Source§

unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8

Implementors§

impl Peek for ItemUid

impl Peek for FrameId

impl<T> Peek for Binding<T>
where T: Default + Peek,

impl Peek for AlphaType

impl Peek for BorderStyle

impl Peek for ClipMode

impl Peek for ColorDepth

impl Peek for ColorRange

impl Peek for ColorSpace

impl Peek for DisplayItem

impl Peek for ExtendMode

impl Peek for FillRule

impl Peek for FilterOp

impl Peek for LineStyle

impl Peek for RasterSpace

impl Peek for RepeatMode

impl Peek for Rotation

impl Peek for YuvData

impl Peek for YuvFormat

impl Peek for BorderSide

impl Peek for ClipChainId

impl Peek for ClipId

impl Peek for ColorF

impl Peek for ColorU

impl Peek for DocumentId

impl Peek for Gradient

impl Peek for IdNamespace

impl Peek for ImageKey

impl Peek for ImageMask

impl Peek for PipelineId

impl Peek for Shadow

impl Peek for SpatialId

impl Peek for LayoutPixel

impl<T> Peek for PropertyBinding<T>
where T: Default + Peek,

impl<T> Peek for PropertyBindingKey<T>
where T: Default + Peek,