[][src]Struct punt::Page

pub struct Page(_);

A page in the punt microcontroller's flash memory.

Methods

impl Page[src]

pub fn from_index(index: u8) -> Self[src]

Creates a page from its index, starting at 0 at FLASH_BASE, with each page being PAGE_SIZE bytes.

pub fn from_address(address: u32) -> Self[src]

Refers to the page containing the given address.

pub fn begin(&self) -> u32[src]

The first address in a page.

Examples

use punt::FLASH_BASE;

let page = Page::from_index(0);
assert_eq!(page.begin(), FLASH_BASE);

pub fn end(&self) -> u32[src]

Returns the address of the last byte of a page.

Examples

use punt::{FLASH_BASE, PAGE_SIZE};

let page = Page::from_index(0);
let end = page.end();
assert_eq!(end, FLASH_BASE + PAGE_SIZE - 1);
let next_page = Page::from_address(end + 1);
let next_page_index: u8 = next_page.into();
assert_eq!(next_page_index, 1);

Trait Implementations

impl Clone for Page[src]

impl Debug for Page[src]

impl Eq for Page[src]

impl Into<u8> for Page[src]

impl<'_> Into<u8> for &'_ Page[src]

impl Ord for Page[src]

impl PartialEq<Page> for Page[src]

impl PartialOrd<Page> for Page[src]

impl StructuralEq for Page[src]

impl StructuralPartialEq for Page[src]

Auto Trait Implementations

impl RefUnwindSafe for Page

impl Send for Page

impl Sync for Page

impl Unpin for Page

impl UnwindSafe for Page

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.