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,

Source§

fn zero(&mut self)

Overwrites self with zeros. Read more
Source§

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

Source§

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, T> IoLoc<Region<SIZE>, T> for ()
where T: FixedRegister,

Allows () to be used as the location parameter of Io::write when passing a FixedRegister value.

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

impl<const SIZE: usize, T> IoLoc<Region<SIZE>, T> for T
where T: FixedRegister,

A FixedRegister carries its location in its type. Thus FixedRegister values can be used as an IoLoc.

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

impl<const SIZE: usize, T> IoLoc<Region<SIZE>, T> for FixedRegisterLoc<T>
where T: FixedRegister,

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

impl<const SIZE: usize, T, B> IoLoc<Region<SIZE>, T> for RelativeRegisterLoc<T, B>

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

impl<const SIZE: usize, T> IoLoc<Region<SIZE>, T> for RegisterArrayLoc<T>
where T: RegisterArray,

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

impl<const SIZE: usize, T, B> IoLoc<Region<SIZE>, T> for RelativeRegisterArrayLoc<T, B>

Source§

type IoType = <T as Register>::Storage

Size (u8, u16, etc) of the I/O performed on the returned offset.
Source§

fn offset(self) -> usize

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

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

Source§

type IoType = u8

Size (u8, u16, etc) of the I/O performed on the returned offset.
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§

type IoType = u16

Size (u8, u16, etc) of the I/O performed on the returned offset.
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§

type IoType = u32

Size (u8, u16, etc) of the I/O performed on the returned offset.
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§

type IoType = u64

Size (u8, u16, etc) of the I/O performed on the returned offset.
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, T> LocatedRegister<Region<SIZE>> for T
where T: FixedRegister,

Source§

type Location = FixedRegisterLoc<<T as LocatedRegister<Region<SIZE>>>::Value>

Full location information at which to write the value.
Source§

type Value = T

Register value to write.
Source§

fn into_io_op(self) -> (FixedRegisterLoc<T>, T)

Consumes self and returns a (location, value) tuple describing a valid I/O write operation.
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
Source§

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

Source§

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

Source§

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