Skip to main content

Validator

Trait Validator 

Source
pub trait Validator {
    // Required method
    fn is_valid(&self, buffer: &[u8]) -> bool;
}
Available on crate feature zero-copy only.
Expand description

A trait for validating zero-copy types.

Required Methods§

Source

fn is_valid(&self, buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Validator for bool

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for char

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for f32

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for f64

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for i8

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for i16

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for i32

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for i64

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for i128

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for isize

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for u8

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for u16

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for u32

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for u64

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for u128

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl Validator for usize

Source§

fn is_valid(&self, _buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Source§

impl<T: ZeroCopy + Validator, const N: usize> Validator for [T; N]

Source§

fn is_valid(&self, buffer: &[u8]) -> bool

Checks if the relative pointer is valid within the given buffer.

Implementors§

Source§

impl<E: Endian> Validator for ZeroStr<E>

Source§

impl<T: ZeroCopy, const ALIGN: usize, E: Endian> Validator for RelativePtr<T, ALIGN, E>

Source§

impl<T: ZeroCopy, const ALIGN: usize, E: Endian> Validator for ZeroSlice<T, ALIGN, E>

Source§

impl<T: ZeroCopy, const N: usize, const ALIGN: usize, E: Endian> Validator for ZeroArray<T, N, ALIGN, E>

Source§

impl<const CAP: usize, E: Endian> Validator for ZeroString<CAP, E>