Skip to main content

ArrayReader

Struct ArrayReader 

Source
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

Source

pub fn new(layout: ArrayLayout) -> ArrayReader

Source

pub fn layout(&self) -> &ArrayLayout

Source

pub fn shard_of(&self, time_chunk: u32) -> Result<u32, DecodeError>

The shard a time chunk lives in.

Source

pub fn has_shard_index(&self, shard: u32) -> bool

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn clear_cache(&mut self)

Drop the decoded tiles; the shard indices stay.

Trait Implementations§

Source§

impl Clone for ArrayReader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ArrayReader

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for ArrayReader

§

impl Freeze for ArrayReader
where *const LeafNode<u32, Vec<Option<ShardIndexEntry>>> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(u32, Vec<Option<ShardIndexEntry>>)>>: Freeze, *const LeafNode<u32, Option<Vec<u8>>> is !null: Freeze, PhantomData<Box<(u32, Option<Vec<u8>>)>>: Freeze,

§

impl Move for ArrayReader

§

impl RefUnwindSafe for ArrayReader

§

impl Send for ArrayReader
where NodeRef<Owned, u32, Vec<Option<ShardIndexEntry>>, LeafOrInternal>: Send, BoxRaw<(u32, Vec<Option<ShardIndexEntry>>)>: Send, NodeRef<Owned, u32, Option<Vec<u8>>, LeafOrInternal>: Send, BoxRaw<(u32, Option<Vec<u8>>)>: Send,

§

impl Sync for ArrayReader
where NodeRef<Owned, u32, Vec<Option<ShardIndexEntry>>, LeafOrInternal>: Sync, BoxRaw<(u32, Vec<Option<ShardIndexEntry>>)>: Sync, NodeRef<Owned, u32, Option<Vec<u8>>, LeafOrInternal>: Sync, BoxRaw<(u32, Option<Vec<u8>>)>: Sync,

§

impl Unpin for ArrayReader
where *const LeafNode<u32, Vec<Option<ShardIndexEntry>>> is !null: Unpin, Box<(u32, Vec<Option<ShardIndexEntry>>)>: Unpin, *const LeafNode<u32, Option<Vec<u8>>> is !null: Unpin, Box<(u32, Option<Vec<u8>>)>: Unpin,

§

impl UnsafeUnpin for ArrayReader

§

impl UnwindSafe for ArrayReader

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.