pub struct SwizzleReshapeCodec {
pub axes: Vec<AxisGroup>,
}
Expand description
Codec to swizzle/swap the axes of an array and reshape it.
This codec does not store metadata about the original shape of the array. Since axes that have been combined during encoding cannot be split without further information, decoding may fail if an output array is not provided.
Swizzling axes is always supported since no additional information about the array’s shape is required to reconstruct it.
Fields§
§axes: Vec<AxisGroup>
The permutation of the axes that is applied on encoding.
The permutation is given as a list of axis groups, where each group
corresponds to one encoded output axis that may consist of several
decoded input axes. For instance, [[0], [1, 2]]
flattens a three-
dimensional array into a two-dimensional one by combining the second and
third axes.
The permutation also allows specifying a special catch-all remaining axes marker:
[[0], {}]
moves the second axis to be the first and appends all other axes afterwards, i.e. the encoded array has the same number of axes as the input array[[0], [{}]]
in contrast collapses all other axes into one, i.e. the encoded array is two-dimensional
Trait Implementations§
Source§impl Clone for SwizzleReshapeCodec
impl Clone for SwizzleReshapeCodec
Source§fn clone(&self) -> SwizzleReshapeCodec
fn clone(&self) -> SwizzleReshapeCodec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Codec for SwizzleReshapeCodec
impl Codec for SwizzleReshapeCodec
Source§fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
data
and returns the result. Read moreSource§fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
encoded
data and returns the result. Read moreSource§fn decode_into(
&self,
encoded: AnyArrayView<'_>,
decoded: AnyArrayViewMut<'_>,
) -> Result<(), Self::Error>
fn decode_into( &self, encoded: AnyArrayView<'_>, decoded: AnyArrayViewMut<'_>, ) -> Result<(), Self::Error>
Source§impl<'de> Deserialize<'de> for SwizzleReshapeCodec
impl<'de> Deserialize<'de> for SwizzleReshapeCodec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SwizzleReshapeCodec
impl JsonSchema for SwizzleReshapeCodec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn always_inline_schema() -> bool
fn always_inline_schema() -> bool
$ref
keyword. Read moreSource§impl Serialize for SwizzleReshapeCodec
impl Serialize for SwizzleReshapeCodec
Source§impl StaticCodec for SwizzleReshapeCodec
impl StaticCodec for SwizzleReshapeCodec
Source§type Config<'de> = SwizzleReshapeCodec
type Config<'de> = SwizzleReshapeCodec
Source§fn from_config(config: Self::Config<'_>) -> Self
fn from_config(config: Self::Config<'_>) -> Self
config
uration.Source§fn get_config(&self) -> StaticCodecConfig<'_, Self>
fn get_config(&self) -> StaticCodecConfig<'_, Self>
Auto Trait Implementations§
impl Freeze for SwizzleReshapeCodec
impl RefUnwindSafe for SwizzleReshapeCodec
impl Send for SwizzleReshapeCodec
impl Sync for SwizzleReshapeCodec
impl Unpin for SwizzleReshapeCodec
impl UnwindSafe for SwizzleReshapeCodec
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)