ErrorenumWhy an operation failed.
Appearance
Find the interface for your task, try it on a small matrix, then follow its exact declaration and ownership rules. This reference covers the Rust crate cellpack.
Type names inside declarations are clickable: open a definition beside the page, inspect its source, or continue to the full API entry. Run example executes a fixed, prebuilt program on the configured server. Code is read-only. Enable LSP for type information and definition lookup within the current example file. Runnable examples explain the shared fixture and local setup.
| I want to… | Start here | What to watch |
|---|---|---|
| Write matrix rows to a file | CpkWriter | Declare the input dtype/layout; call finish before opening the file |
| Read or reorder selected rows | ReadSelection | File-row IDs, output element counts, and exclusive workspace |
| Map columns into another order | CpkFile::prepare_selection | The map is source → output; lists preserve row repetitions |
| Produce batches for training | Loader | Source → schemas → accesses → ring → run |
| Consume batches safely | Run | Overlap production and consumption; release leases when readers finish |
| Generate an access order | Accesses | Global cell IDs; calls may be concurrent, repeated, or out of order |
| Reuse cached pages and rows | Plans and costs | Cache capacity is not total RSS; modeled time is not measured time |
| Encode records in my own container | Codecs | Caller buffers, matching metadata, and trusted-record requirements |
CpkWriter::createDeclare dtype, layout and column count.
appendAdd matching matrix rows in order.
finishPublish the complete stream before reading.
CpkFile::openRead the finalized stream.
prepare_readBind row selection and output dimensions.
read_dense_intoDecode into caller-owned output.
The caller owns the output and can reuse ReadWorkspace after each read.
DataSourceBuilderBind files and source-to-standard column maps.
OutputSchemaChoose panels, dtypes and optional processing.
LoaderConstruct a loader with worker and I/O settings.
prepareBind accesses, compatible ring and planning mode.
Run::for_each_batchRead ordered output while production runs.
Keep leases alive until readers finish; every slot is bounded reusable storage.
Use data contracts for units, dtype conversions, ID spaces, and lifetime rules.
| Module | Responsibility | Input | Output |
|---|---|---|---|
| Matrix storage: store | Streaming files and ordered selections | Matrix row batches, files, selectors | .cpk streams and typed matrix buffers |
| Codecs: scans | Encoding, decoding, packing, casting and mapping | Borrowed bytes, metadata, tables, workspace | Encoded bytes, decoded arrays, borrowed row parts |
| Metadata: format | Parse and inspect byte layouts | Stream/chunk metadata bytes | Borrowed views and owned directory records |
| Data delivery: loader | Sources, schemas, sequences, workers, rings and process ABI | Immutable input files and deterministic access requests | Ordered batches with per-schema byte regions |
| Planning: opt | Frame residency and cost-guided compilation | Graph, sequence, cache budget, cost model | Plans, replay summaries and online statistics |
| Timing: prof | Selected timing sites and report aggregation | Site masks and per-thread measurements | Site, detail and histogram reports |
| Process settings: runtime | Kernel binding and core topology | Explicit options or environment | Process-lifetime runtime and physical-core count |
| Errors and root exports | Error domains and convenience imports | Operation results and failure causes | Typed errors and recovery scope |
Search by name or responsibility, then filter by module and kind. Quick view keeps your place while showing the declaration and a source excerpt.
206 interfaces
ErrorenumWhy an operation failed.
format::cpk::ENTRY_LENconstantBytes of one directory entry.
format::cpk::SUPERBLOCK_LENconstantBytes reserved for the superblock at the start of the file.
Numeric type of a matrix’s values; its width is the chunks’ value width.
The form a matrix arrived in.
Parses and checks the directory against its superblock: the hash, rows that tile 0..n_rows in order, and page-aligned, ascending, non-overlapping chunks after the superblock and before the directory.
Parses a superblock (at least SUPERBLOCK_LEN bytes) and checks its fields against each other; the hash is checked by parse_directory .
format::cpk::ChunkEntrystructOne chunk: rows first_row..first_row + n_rows at offset , len bytes of which the first meta_len are its metadata.
format::cpk::SuperblockstructDecoded superblock fields.
How a record stores its elements.
Parses metadata from the start of bytes (the metadata alone or a whole chunk). Checks the header and section sizes; per-cell table entries are checked where they are read.
Element count of a record from its header alone: the varint after the flags byte (0 for an empty record). For a sparse record it counts stored entries (explicit zeros included); for a dense record, non-zero values. A caller can compare it with metadata before committing to a decode.
format::MetastructInterpretation of a chunk’s metadata bytes. Holds no data of its own: header fields are decoded once, sections are borrowed.
format::OwnedMetastructImmutable metadata bytes and a validated descriptor. Views borrow only this owner; section offsets avoid self-referential pointers and lifetime extension.
loader::CONVERSIONSconstantClasses in Conversion ’s numbering; the cost model’s table size.
loader::MAX_SCHEMASconstantMost schemas one loader outputs.
loader::PROCESS_ABI_VERSIONconstantThe process ABI the loader implements: the layout of ProcessContext , CsrRow and DenseRow . A callback built against another version must not be passed to ProcessFn .
loader::PROCESS_BOUNDSconstantElement-count boundaries of the process site’s size bands; a call’s element count (output dims for a dense record, stored elements otherwise) belongs to the band below the first boundary above it.
loader::REGION_ALIGNconstantAlignment of each schema’s region within a slot.
loader::SLOT_ALIGNconstantAlignment of slots.
Outcome of a bounded owned-lease acquisition.
Cost classes of conversions, as the cost model prices them.
loader::ErrorenumA loader failure.
How a worker reads: the platform’s asynchronous ring, or blocking preadv.
loader::PlanningenumHow a run caches.
The row format a process function receives.
Whether values stored as s may be output as t : the same type, lossless widening, same-width signed to unsigned (negatives are not checked), signed to wider unsigned, and any integer to a float.
loader::BatchstructBorrowed slot lease. Output references cannot outlive this guard.
loader::BatchLeasestructOwned slot lease, suitable for foreign-runtime array base objects.
loader::CountersstructEvent counts every run keeps.
loader::CsrRowstructA CSR row: nnz stored elements with output columns in the chunk’s coded order (not sorted) and values of the schema’s dtype. Every other output dim is a zero or missing (see the module notes). A dense record delivered as a CSR row lists its non-zeros.
loader::DataSourcestructEvery input matrix, numbered by global cell id, with each matrix’s map from its columns to the standard ids (the data side of the panel). Shared by planner and workers.
Registers matrices one at a time, then composes them into a DataSource .
loader::DenseRowstructA dense row: out_dim values of the schema’s dtype: the stored value or 0 at present dims, the schema’s default at missing dims (see the module notes).
loader::ExternAccessesstructA sequence computed by a native function.
A native corpus generator bound to the registered datasets’ row counts.
loader::IoStatsstructRead statistics of one worker, summed over workers in RunStats .
loader::LoaderstructOne data source and the schemas that output its cells, ready to serve runs.
loader::LoaderConfigstructHow a loader’s runs execute: threads, I/O backend, windowing and profiling.
loader::MemoryEstimatestructBytes a run reserves, by purpose. Each term is a known reservation, not a measured footprint: allocator overhead, the compiler’s own state and the OS page cache are outside it, and reserved bytes need not be resident.
The module indexes enumerate every documented public item, including supporting enums, constants, traits and low-level helpers. Detail pages are regenerated from the crate source at build time. Public signatures, field types and method lists are therefore linked to the build, while semantic contracts are maintained in the module references.
Declarations, member links, implemented traits, and source excerpts come from the same build. Parameter explanations and worked examples add the usage context.