[][src]Trait peek_poke::Peek

pub trait Peek: Poke {
    unsafe fn peek_from(bytes: *const u8, output: *mut Self) -> *const u8;
}

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

Example

This example is not tested
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:

Required methods

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().

Loading content...

Implementations on Foreign Types

impl Peek for i8[src]

impl Peek for i16[src]

impl Peek for i32[src]

impl Peek for i64[src]

impl Peek for isize[src]

impl Peek for u8[src]

impl Peek for u16[src]

impl Peek for u32[src]

impl Peek for u64[src]

impl Peek for usize[src]

impl Peek for f32[src]

impl Peek for f64[src]

impl Peek for bool[src]

impl<T> Peek for PhantomData<T>[src]

impl<T: Default + Peek> Peek for Option<T>[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl Peek for ()[src]

impl<A: Peek> Peek for (A,)[src]

impl<A: Peek, B: Peek> Peek for (A, B)[src]

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

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

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

Loading content...

Implementors

Loading content...