Trait zarrs::array::codec::ArrayCodecTraits
source · pub trait ArrayCodecTraits: CodecTraits {
// Required methods
fn recommended_concurrency(
&self,
decoded_representation: &ChunkRepresentation
) -> Result<RecommendedConcurrency, CodecError>;
fn encode(
&self,
decoded_value: Vec<u8>,
decoded_representation: &ChunkRepresentation,
options: &CodecOptions
) -> Result<Vec<u8>, CodecError>;
fn decode(
&self,
encoded_value: Vec<u8>,
decoded_representation: &ChunkRepresentation,
options: &CodecOptions
) -> Result<Vec<u8>, CodecError>;
// Provided methods
fn decode_into_array_view(
&self,
encoded_value: &[u8],
decoded_representation: &ChunkRepresentation,
array_view: &ArrayView<'_>,
options: &CodecOptions
) -> Result<(), CodecError> { ... }
fn partial_decode_granularity(
&self,
decoded_representation: &ChunkRepresentation
) -> ChunkShape { ... }
}
Expand description
Traits for both array to array and array to bytes codecs.
Required Methods§
sourcefn recommended_concurrency(
&self,
decoded_representation: &ChunkRepresentation
) -> Result<RecommendedConcurrency, CodecError>
fn recommended_concurrency( &self, decoded_representation: &ChunkRepresentation ) -> Result<RecommendedConcurrency, CodecError>
Return the recommended concurrency for the requested decoded representation.
§Errors
Returns CodecError
if the decoded representation is not valid for the codec.
sourcefn encode(
&self,
decoded_value: Vec<u8>,
decoded_representation: &ChunkRepresentation,
options: &CodecOptions
) -> Result<Vec<u8>, CodecError>
fn encode( &self, decoded_value: Vec<u8>, decoded_representation: &ChunkRepresentation, options: &CodecOptions ) -> Result<Vec<u8>, CodecError>
Encode a chunk.
§Errors
Returns CodecError
if a codec fails or decoded_value
is incompatible with decoded_representation
.
sourcefn decode(
&self,
encoded_value: Vec<u8>,
decoded_representation: &ChunkRepresentation,
options: &CodecOptions
) -> Result<Vec<u8>, CodecError>
fn decode( &self, encoded_value: Vec<u8>, decoded_representation: &ChunkRepresentation, options: &CodecOptions ) -> Result<Vec<u8>, CodecError>
Decode a chunk.
§Errors
Returns CodecError
if a codec fails or the decoded output is incompatible with decoded_representation
.
Provided Methods§
sourcefn decode_into_array_view(
&self,
encoded_value: &[u8],
decoded_representation: &ChunkRepresentation,
array_view: &ArrayView<'_>,
options: &CodecOptions
) -> Result<(), CodecError>
fn decode_into_array_view( &self, encoded_value: &[u8], decoded_representation: &ChunkRepresentation, array_view: &ArrayView<'_>, options: &CodecOptions ) -> Result<(), CodecError>
sourcefn partial_decode_granularity(
&self,
decoded_representation: &ChunkRepresentation
) -> ChunkShape
fn partial_decode_granularity( &self, decoded_representation: &ChunkRepresentation ) -> ChunkShape
Return the partial decode granularity.
This represents the shape of the smallest subset of a chunk that can be efficiently decoded if the chunk were subdivided into a regular grid. For most codecs, this is just the shape of the chunk. It is the shape of the “inner chunks” for the sharding codec.
Implementors§
impl ArrayCodecTraits for BitroundCodec
Available on crate feature
bitround
only.impl ArrayCodecTraits for TransposeCodec
Available on crate feature
transpose
only.impl ArrayCodecTraits for BytesCodec
impl ArrayCodecTraits for CodecChain
impl ArrayCodecTraits for PcodecCodec
Available on crate feature
pcodec
only.impl ArrayCodecTraits for ShardingCodec
Available on crate feature
sharding
only.impl ArrayCodecTraits for ZfpCodec
Available on crate feature
zfp
only.