Skip to main content

DescriptorValidator

Struct DescriptorValidator 

Source
pub struct DescriptorValidator { /* private fields */ }
Expand description

Validator for message descriptors.

Ensures that descriptors only reference regions with policies that are safe for zero-copy message passing (Immutable or AppendOnly).

Implementations§

Source§

impl DescriptorValidator

Source

pub const fn new() -> Self

Create a new validator with default settings (Immutable and AppendOnly allowed).

Source

pub const fn immutable_only() -> Self

Create a validator that only allows Immutable regions.

Source

pub fn validate_policy(&self, policy: &RegionPolicy) -> Result<()>

Validate that a region policy is safe for descriptor-based messaging.

§Errors

Returns InvalidDescriptorRegion if the policy doesn’t allow descriptors.

Source

pub fn validate_bounds( &self, descriptor: &MessageDescriptor, region_size: usize, ) -> Result<()>

Validate a descriptor against region bounds.

§Arguments
  • descriptor - The descriptor to validate
  • region_size - The total size of the region
§Errors

Returns InvalidParameter if the descriptor references memory outside the region.

Source

pub fn validate( &self, descriptor: &MessageDescriptor, policy: &RegionPolicy, region_size: usize, ) -> Result<()>

Full validation of a descriptor.

Checks that:

  1. The descriptor is valid (non-null region, non-zero length)
  2. The region policy allows descriptors
  3. The offset + length is within region bounds

Trait Implementations§

Source§

impl Default for DescriptorValidator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.