Trait peek_poke::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().

Object Safety§

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§