Struct planetkit::globe::CursorMut
[−]
[src]
pub struct CursorMut<'a> { /* fields omitted */ }
A cell-oriented view into a mutable globe.
Behaves similarly to an iterator, in that it borrows the globe being viewed, but unlike an iterator it offers multiple methods for navigating between elements.
CursorMut
exists to help with algorithms that perform a lot of local
navigation between cells, by avoiding the high cost of random access.
Mutable cursor is needed for anything that either needs to manipulate the cells in the globe, or anything else on the globe like which chunks are loaded.
Methods
impl<'a> CursorMut<'a>
[src]
fn new_in_chunk(
globe: &'a mut Globe,
chunk_origin: ChunkOrigin
) -> CursorMut<'a>
[src]
globe: &'a mut Globe,
chunk_origin: ChunkOrigin
) -> CursorMut<'a>
Creates a new cursor at the origin of the given chunk.
Use this if you know that a particular chunk is loaded, and you want to read cells from that chunk rather than any neighboring chunk that might share the same cells.
Note that the given chunk might not own the cells you're asking for; they might belong to a different root quad.
fn pos(&self) -> GridPoint3
[src]
fn set_pos(&mut self, new_pos: GridPoint3)
[src]
fn globe(&self) -> &Globe
[src]
fn cell(&mut self) -> Option<&mut Cell>
[src]
Get a reference to the cell the cursor is currently pointing at.
Note that this cell might come from a chunk that doesn't own it, unless you've deliberately ensured you pointed at the cell in its owning root.
Returns None
if the requested cell is in a chunk that isn't loaded.