API
The public types of the candding crate, the feature flags, the compatibility guarantees and where the generated reference lives.
The crate exposes a small surface: one model type, one builder, the descriptor that describes a model, one error enum, and the device helpers. Everything else, tokenization, pooling, batching and the family implementations, is reachable but rarely needed, because the pipeline is the same for every model.
Public types
| Type | Purpose |
|---|---|
TextEmbedding | a loaded model; embed, query_embed, passage_embed, their _dim variants, query_embed_with_instruction, token_count, and the descriptor, dim, max_length, device and dtype accessors |
TextEmbeddingBuilder | construction from a model id or a directory, with device, dtype, max_length, batch_size, revision and descriptor |
ModelDescriptor | everything about a model beyond its weights: dimension, default length, pooling, normalization, templates, default instruction, Dense directories, Matryoshka flag, license, size, gating, phase and backend status |
BackendSupport | the CPU, Metal and CUDA verification status of one model |
Support | one status: verified, pending or untested |
Family | the architecture a model belongs to, and the mapping from a model_type string |
Pooling | CLS, mean or last token |
CanddingError | every failure the crate produces, from a missing file to an unsupported architecture |
Result<T> | the crate's result alias over CanddingError |
Device | candle's device, re-exported so callers need no direct candle dependency |
DType | candle's dtype, re-exported for the same reason |
device::auto | Metal, then CUDA, then CPU, depending on the compiled features |
device::cpu | the CPU device |
device::metal | a Metal device by ordinal |
device::cuda | a CUDA device by ordinal |
device::describe | the short backend name used in logs and errors |
Feature flags
| Feature | Default | What it does |
|---|---|---|
hf-cli | on | downloads a missing model by shelling out to the hf CLI |
metal | off | the Metal backend on Apple GPUs |
cuda | off | the CUDA backend on NVIDIA GPUs |
cudnn | off | implies cuda and adds the cuDNN kernels |
accelerate | off | Apple's BLAS on CPU |
mkl | off | Intel's BLAS on CPU |
model-tests | off | test-only, enables the suites that need downloaded weights |
There is no per-model or per-family feature: every family compiles in unconditionally, and the flags above are the whole matrix.
Compatibility
| Property | Value |
|---|---|
| Edition | 2024 |
| Minimum Rust | the rust-version field of the workspace Cargo.toml |
| candle | the candle 0.11 line as pinned in Cargo.toml, for both candle-core and candle-nn |
| License | Apache-2.0 OR MIT |
The crate depends on candle, tokenizers, serde and thiserror, and on nothing that needs a system runtime: there is no ONNX runtime, no Python and no candle-transformers. Adding a GPU is a candle feature, not a different code path, which is what the devices and dtypes page describes.
Reference documentation
Item-level documentation is generated from the source, so the crate itself is the reference:
cargo doc -p candding --no-deps --openThe hosted docs.rs page follows the first crates.io release; until then the git dependency in getting started and the locally generated documentation are the way to read the API.