Skip to main content

decode

Function decode 

Source
pub fn decode<D: Dimension>(
    byte_arrays: &[Vec<u8>],
    shape: D,
    encoding: &str,
) -> FerrayResult<StringArray<D>>
Expand description

Decode UTF-8 byte buffers back into a StringArray preserving the input shape.

Equivalent to numpy.strings.decode(arr, encoding="utf-8") for the UTF-8 case. The number of byte-buffers must equal the array’s element count. Invalid UTF-8 produces FerrayError::InvalidValue.

§Errors

  • FerrayError::ShapeMismatch if byte_arrays.len() != shape_len().
  • FerrayError::InvalidValue for unsupported encoding or invalid UTF-8.