pub struct ArrayReader { /* private fields */ }Expand description
A variable array being read: its layout, the shard indices handed over so far and the decoded tiles of one time chunk.
Implementations§
Source§impl ArrayReader
impl ArrayReader
pub fn new(layout: ArrayLayout) -> ArrayReader
pub fn layout(&self) -> &ArrayLayout
Sourcepub fn shard_of(&self, time_chunk: u32) -> Result<u32, DecodeError>
pub fn shard_of(&self, time_chunk: u32) -> Result<u32, DecodeError>
The shard a time chunk lives in.
pub fn has_shard_index(&self, shard: u32) -> bool
Sourcepub fn set_shard_index(
&mut self,
shard: u32,
bytes: &[u8],
) -> Result<(), DecodeError>
pub fn set_shard_index( &mut self, shard: u32, bytes: &[u8], ) -> Result<(), DecodeError>
Verify one shard’s index — its length, its CRC-32C and every entry —
and hold it. bytes is exactly the index, read from whichever end of
the shard the layout names.
Sourcepub fn chunk_range(
&self,
time_chunk: u32,
tile: u32,
) -> Result<Option<ShardIndexEntry>, DecodeError>
pub fn chunk_range( &self, time_chunk: u32, tile: u32, ) -> Result<Option<ShardIndexEntry>, DecodeError>
Where one inner chunk sits in its shard, or None for a chunk the
shard never held, which reads as the fill value. An error until the
shard’s index has been handed over.
Sourcepub fn tiles_for(
&self,
rects: Option<&[TileRect]>,
) -> Result<Vec<u32>, DecodeError>
pub fn tiles_for( &self, rects: Option<&[TileRect]>, ) -> Result<Vec<u32>, DecodeError>
The tiles a list of tile rectangles names, ascending, or every tile when there is no list. Rectangles may overlap; a tile is named once.
Sourcepub fn undecoded_tiles(&self, time_chunk: u32, tiles: &[u32]) -> Vec<u32>
pub fn undecoded_tiles(&self, time_chunk: u32, tiles: &[u32]) -> Vec<u32>
Which of tiles are not decoded for time_chunk: the ones
ArrayReader::feed_chunk still has to be given before a frame of
that time chunk assembles over them.
Sourcepub fn feed_chunk(
&mut self,
time_chunk: u32,
tile: u32,
payload: Option<&[u8]>,
) -> Result<(), DecodeError>
pub fn feed_chunk( &mut self, time_chunk: u32, tile: u32, payload: Option<&[u8]>, ) -> Result<(), DecodeError>
Decode one inner chunk and hold it. payload is the chunk’s bytes as
the shard holds them, or None for a chunk the shard never held.
Moving to another time chunk drops the tiles of the one held. Frames
are planes of bytes, so a uint16 array is refused here; its cells
are read with super::series_from_chunks.
Sourcepub fn assemble_frame(
&self,
frame_index: u32,
rects: Option<&[TileRect]>,
) -> Result<Vec<u8>, DecodeError>
pub fn assemble_frame( &self, frame_index: u32, rects: Option<&[TileRect]>, ) -> Result<Vec<u8>, DecodeError>
One frame as a new plane of height × width codes. With rects only
those tiles are written and every cell outside them is zero, which
says nothing about the data there: a caller draws only what it asked
for. An error unless every tile named has been fed for the frame’s
time chunk.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Drop the decoded tiles; the shard indices stay.
Trait Implementations§
Source§impl Clone for ArrayReader
impl Clone for ArrayReader
Auto Trait Implementations§
impl Forget for ArrayReader
impl Freeze for ArrayReader
impl Move for ArrayReader
impl RefUnwindSafe for ArrayReader
impl Send for ArrayReader
impl Sync for ArrayReader
impl Unpin for ArrayReader
impl UnsafeUnpin for ArrayReaderwhere
*const LeafNode<u32, Vec<Option<ShardIndexEntry>>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(u32, Vec<Option<ShardIndexEntry>>)>>: UnsafeUnpin,
*const LeafNode<u32, Option<Vec<u8>>> is !null: UnsafeUnpin,
PhantomData<Box<(u32, Option<Vec<u8>>)>>: UnsafeUnpin,
impl UnwindSafe for ArrayReaderwhere
BTreeMap<u32, Vec<Option<ShardIndexEntry>>>: UnwindSafe,
BTreeMap<u32, Option<Vec<u8>>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more