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

Host

Trait Host 

Source
pub trait Host {
    // Required methods
    fn extent(&self, key: ResourceKey) -> Option<Extent>;
    fn walk_distance(&self, key: ResourceKey) -> u32;
    fn submit(&mut self, request: &ReadRequest) -> Submit;
    fn cancel(&mut self, request: RequestId);

    // Provided methods
    fn can_accept(&self) -> bool { ... }
    fn promote(&mut self, _request: RequestId, _class: Class) { ... }
    fn move_pages(
        &mut self,
        _pool: u8,
        _from_page: u32,
        _to_page: u32,
        _page_count: u32,
    ) { ... }
}
Expand description

Everything the engine needs from the game, the region graph and the transport. One value implements it; the engine borrows it for a call.

Required Methods§

Source

fn extent(&self, key: ResourceKey) -> Option<Extent>

Disc position and size of key, or None when the key is unknown.

Source

fn walk_distance(&self, key: ResourceKey) -> u32

Walk distance from the viewer to key, in the same units as crate::Wanted::distance. Asked only for resident resources the current wanted list did not mention, when eviction needs to rank them.

Source

fn submit(&mut self, request: &ReadRequest) -> Submit

Queue request. A Submit::Full answer rolls the allocation back.

Source

fn cancel(&mut self, request: RequestId)

Stop request. The transport reports ReadOutcome::Cancelled (or ReadOutcome::Done if the sectors had already landed) through crate::Residency::complete_read; the pages stay reserved until then.

Provided Methods§

Source

fn can_accept(&self) -> bool

Whether the transport can take another request right now.

Source

fn promote(&mut self, _request: RequestId, _class: Class)

A request already in flight is now wanted at a more urgent class.

Source

fn move_pages( &mut self, _pool: u8, _from_page: u32, _to_page: u32, _page_count: u32, )

Move page_count pages of pool from from_page to to_page (a memmove). Called only for categories configured as movable.

Implementors§