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

Request

Struct Request 

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

A run of sectors to read into memory.

Built with Request::new_raw, then refined with the with_* methods.

Implementations§

Source§

impl Request

Source

pub const unsafe fn new_raw( lba: u32, sectors: u32, destination: *mut u32, ) -> Self

Read sectors sectors starting at lba (program-relative, shifted by the loader’s disc base like every SDK disc read) into destination.

§Safety

destination must be word-aligned and valid for writes of sectors * 2048 bytes, and nothing else may read or write that memory from the moment the request is submitted until it has finished (see Engine::state). The transport writes from the interrupt handler, so the memory is not held by any borrow the compiler can see. Memory that is only ever read through read_volatile until the request finishes meets this.

Source

pub const fn with_priority(self, priority: Priority) -> Self

Serve this request at priority.

Source

pub const fn with_resumes(self, times: u8) -> Self

Let the transport pick this request up again from where it stopped, up to times times, when the drive reports an error mid-transfer. Each resume costs the recovery pause and one seek. With 0 (the default) an error ends the request as Outcome::Failed and the caller decides.

Source

pub const fn with_byte_len(self, bytes: u32) -> Self

Store only bytes bytes instead of sectors * 2048: the last sector is popped whole but only its first words, rounded up to a word, are written, so a transfer never writes past a chunk that does not end on a sector boundary.

bytes must lie in (sectors - 1) * 2048 + 1 ..= sectors * 2048; anything else is ignored (every sector stored whole). The destination then only has to be valid for bytes rounded up to a word.

Source

pub const fn lba(&self) -> u32

First sector.

Source

pub const fn sectors(&self) -> u32

Sector count.

Source

pub const fn priority(&self) -> Priority

Priority.

Source

pub const fn end_lba(&self) -> u32

The sector after the last one, where a request that can chain onto this one starts.

Source

pub unsafe fn remaining_after(&self, received: u32) -> Option<Request>

The rest of this request after received sectors landed: the request to submit to continue an aborted or failed transfer. None when nothing is left.

The result is a request like any other. It starts with a fresh seek, at lba + received, into the destination advanced by received sectors, with the same priority and resume budget.

§Safety

received must be a count the transport reported for this request (or lower): the memory the new request writes is the tail of this request’s destination, and the safety contract of new_raw applies to it again.

Trait Implementations§

Source§

impl Clone for Request

Source§

fn clone(&self) -> Request

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Request

Source§

fn eq(&self, other: &Request) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Request

Source§

impl Eq for Request

Source§

impl StructuralPartialEq for Request

Auto Trait Implementations§

§

impl Freeze for Request

§

impl RefUnwindSafe for Request

§

impl !Send for Request

§

impl !Sync for Request

§

impl Unpin for Request

§

impl UnsafeUnpin for Request

§

impl UnwindSafe for Request

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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.