Skip to main content

Region

Struct Region 

Source
pub struct Region<const SIZE: usize = 0> { /* private fields */ }
Expand description

Untyped I/O region.

This type can be used when an I/O region without known type information has a compile-time known minimum size (and a runtime known actual size).

§Invariants

  • Size of the region is at least as large as the SIZE generic parameter.
  • Size of the region is multiple of 4.

Implementations§

Source§

impl<const SIZE: usize> Region<SIZE>

Source

pub fn ptr_from_raw_parts_mut(base: *mut u8, size: usize) -> *mut Self

Create a raw mutable pointer from given base address and size.

size should be at least as large as the minimum size SIZE, and base and size should be 4-byte aligned to uphold the type invariant.

Just like other methods on raw pointers, it is not unsafe to create a raw pointer that does not uphold the type invariants. However such pointers are not valid.

Source

pub fn ptr_try_from_raw_parts_mut( base: *mut u8, size: usize, ) -> Result<*mut Self>

Create a raw mutable pointer from given base address and size.

The alignment of base is checked, and size is checked against the minimum size specified via const generics.

Trait Implementations§

Source§

impl<const SIZE: usize> FromBytes for Region<SIZE>
where [u8]: FromBytes,

Source§

impl<const SIZE: usize> FromZeros for Region<SIZE>
where [u8]: FromZeros,

§

fn zero(&mut self)

Overwrites self with zeros. Read more
Source§

impl<const SIZE: usize> IntoBytes for Region<SIZE>

§

fn as_mut_bytes(&mut self) -> &mut [u8] ⓘ
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
Source§

impl<const SIZE: usize> IoLoc<Region<SIZE>, u8> for usize

Source§

fn offset(self) -> usize

Consumes self and returns the offset of this location.
Source§

impl<const SIZE: usize> IoLoc<Region<SIZE>, u16> for usize

Source§

fn offset(self) -> usize

Consumes self and returns the offset of this location.
Source§

impl<const SIZE: usize> IoLoc<Region<SIZE>, u32> for usize

Source§

fn offset(self) -> usize

Consumes self and returns the offset of this location.
Source§

impl<const SIZE: usize> IoLoc<Region<SIZE>, u64> for usize

Source§

fn offset(self) -> usize

Consumes self and returns the offset of this location.
Source§

impl<const SIZE: usize> KnownSize for Region<SIZE>

Source§

const MIN_SIZE: usize = SIZE

Minimum size of this type known at compile-time.
Source§

const MIN_ALIGN: Alignment

Minimum alignment of this type known at compile-time.
Source§

fn size(p: *const Self) -> usize

Get the size of an object of this type in bytes, with the metadata of the given pointer.
Source§

impl<const SIZE: usize> TryFromBytes for Region<SIZE>
where [u8]: TryFromBytes,

Auto Trait Implementations§

§

impl<const SIZE: usize = 0> !Sized for Region<SIZE>

§

impl<const SIZE: usize> Freeze for Region<SIZE>

§

impl<const SIZE: usize> RefUnwindSafe for Region<SIZE>

§

impl<const SIZE: usize> Send for Region<SIZE>

§

impl<const SIZE: usize> Sync for Region<SIZE>

§

impl<const SIZE: usize> Unpin for Region<SIZE>

§

impl<const SIZE: usize> UnsafeUnpin for Region<SIZE>

§

impl<const SIZE: usize> UnwindSafe for Region<SIZE>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,