Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

RamCard

Struct RamCard 

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

A 128 KiB card held entirely in memory.

The struct owns the full image inline (128 KiB), so place it in a static or box it on the heap rather than passing it around by value on the small PS1 stack.

Implementations§

Source§

impl RamCard

Source

pub const fn new() -> Self

A blank (all-zero, unformatted) card. Call crate::Card::format to lay down a valid directory.

Source

pub fn from_image(image: &[u8]) -> Result<Self>

Build from an existing 128 KiB image (e.g. a .mcd file loaded on a host).

Source

pub fn image(&self) -> &[u8; 131072]

Borrow the raw 128 KiB image (for persisting to a host file).

Trait Implementations§

Source§

impl Block for RamCard

Source§

fn read_frame(&mut self, frame: u16, out: &mut [u8; 128]) -> Result<()>

Read frame frame (0..FRAME_COUNT) into out.
Source§

fn write_frame(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>

Write data to frame frame (0..FRAME_COUNT).
Source§

impl Default for RamCard

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for RamCard

§

impl RefUnwindSafe for RamCard

§

impl Send for RamCard

§

impl Sync for RamCard

§

impl Unpin for RamCard

§

impl UnsafeUnpin for RamCard

§

impl UnwindSafe for RamCard

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.