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§
Sourcefn extent(&self, key: ResourceKey) -> Option<Extent>
fn extent(&self, key: ResourceKey) -> Option<Extent>
Disc position and size of key, or None when the key is unknown.
Sourcefn walk_distance(&self, key: ResourceKey) -> u32
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.
Sourcefn submit(&mut self, request: &ReadRequest) -> Submit
fn submit(&mut self, request: &ReadRequest) -> Submit
Queue request. A Submit::Full answer rolls the allocation back.
Sourcefn cancel(&mut self, request: RequestId)
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§
Sourcefn can_accept(&self) -> bool
fn can_accept(&self) -> bool
Whether the transport can take another request right now.
Sourcefn promote(&mut self, _request: RequestId, _class: Class)
fn promote(&mut self, _request: RequestId, _class: Class)
A request already in flight is now wanted at a more urgent class.
Sourcefn move_pages(
&mut self,
_pool: u8,
_from_page: u32,
_to_page: u32,
_page_count: u32,
)
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.