Write
- file format 6
- Rust SDK 1.0 preview
Writing a pack from records, in memory or to a file, with an optional appendix. Records are written in sort-key order with a final header line.
On this page, Result<T> is std::result::Result<T, plxi_sdk::Error>.
Every public struct and enum with a public field or variant is marked #[non_exhaustive]: code outside the crate builds one through its constructors and matches an enum with a _ arm.
Functions
pub fn write(records: &[Record], appendix: Option<&AppendixSpec>) -> Result<Vec<u8>>- Summary
Write a pack from
recordsand an optional appendix, in memory.Records are written in sort-key order (spec §5.3); records with equal keys keep their input order. An empty
AppendixSpecwrites no appendix.- Parameters
records: &[Record]appendix: Option<&AppendixSpec>
- Returns
Result<Vec<u8>>- Example
- Example 1: Write and read
- Spec
- Spec §5.3
pub fn write_to_path(
path: impl AsRef<Path>,
records: &[Record],
appendix: Option<&AppendixSpec>,
) -> Result<()>Structs
#[non_exhaustive]
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AppendixSpec { /* private fields */ }- Summary
What to embed as the pack's CSDT appendix.
- Spec
- Spec §7
pub fn compact<R: AsRef<[u8]>>(rows: &[R]) -> Option<AppendixSpec>- Summary
An appendix with one Compact embedding section holding
rows, each exactlyCOMPACT_RECORD_SIZEbytes.Nonewhen a row has another length (a caller mistake, not an error kind).- Parameters
rows: &[R]
- Returns
Option<AppendixSpec>- Spec
- Spec §7
pub fn empty() -> AppendixSpecpub fn with_tensor_f32(
mut self,
name: &str,
shape: &[u64],
data: &[f32],
) -> Option<AppendixSpec>- Summary
Add an
F32tensor.Nonewhenshape's element count is notdata.len().- Parameters
name: &strshape: &[u64]data: &[f32]
- Returns
Option<AppendixSpec>- Spec
- Spec §7
© 2020-2026 Cintile Inc. All Rights Reserved.
Anyone may implement this format. Copying or republishing the text of this specification requires permission from Cintile Inc.