aic-sdk = "=0.24.0". Core SDK: 0.24.0. Signatures and behavior are based on the released crate source. For installation and a complete audio program, use the Rust guide.
Signatures below are declarations. Use the root exports, for example use aic_sdk::{AicError, Model, OtelConfig, ProcessorConfig};. Path and PathBuf refer to std::path types.
Model
Processor, dedicated voice activity detection (VAD) for Vad and Tyto analysis for the analyzers. One model can supply several independent processing instances.
File loading creates a Model<'static>. Buffer loading creates a Model<'a> borrowing its input bytes. The backing bytes must remain valid and immutable for all dependent processors, VADs and analyzers, even if you drop the original model handle. Native reference counting keeps model storage alive; it does not extend the Rust lifetime of borrowed bytes. A file-backed model’s file must not be modified or deleted while the model or dependent objects exist.
Model implements Drop, Send and Sync. Dropping the handle releases its native reference. It does not implement Clone; share a reference or use Arc<Model<'static>> when appropriate.
Model::from_file
path. This is blocking setup work. File and model failures return FileSystemError, ModelInvalid or ModelVersionUnsupported, as applicable. Pass a valid path without embedded NUL characters: this release uses CString::new(...).unwrap(), so a NUL-containing path can panic rather than return AicError.
Model::from_buffer
Vec<u8> does not guarantee that alignment. Misalignment returns ModelDataUnaligned; invalid contents return model errors. The borrow is carried by the returned model and dependent native objects.
include_model!
include_bytes! inside a 64-byte-aligned static allocation and evaluates to a reference to its bytes. The path follows include_bytes! resolution relative to the Rust source file. The file must exist at compile time; this macro does not download it. Its static storage can be used by async processing types.
This declaration is a compile-time embedding pattern; replace the path with an existing compatible model file:
Model::id
"unknown" if the native string is null or cannot be decoded as UTF-8. The borrowed string cannot outlive this model handle.
Model::optimal_sample_rate
Model::optimal_block_size
sample_rate. Use the stream’s actual rate. Initialization validates support for the rate and block combination. Metadata queries return values directly and assert native success; they do not return Result for internal native failures.
Model::download
Requires feature:download-model. Absent when that feature is disabled.
download_dir is relative. Creates missing destination directories.
The downloader can reuse a fresh manifest in memory or in the download directory according to server cache lifetime. It revalidates stale entries, retries manifest resolution when needed and reuses a model file only when its SHA-256 matches. Replacement data is checked before installation. Failures return AicError::ModelDownload(String) with the underlying detail. This method blocks and has no async Rust counterpart in this release; provision models before processing.
ProcessorConfig
optimal. Configuration is copied into the processor, detector or collector at initialization; changing the value later does not reconfigure it. There is no Default implementation.
ProcessorConfig::optimal
variable_block_size: false. Override fields before initialization when the input has a different rate.
ProcessorConfig::with_variable_block_size
OtelConfig
There is no
Default implementation. Configuration is copied at construction; subsequent changes do not affect existing sessions.
OtelConfig::disabled
{ enable: false, session_id: None, export_interval_ms: 0 }.
OtelConfig::enabled
{ enable: true, session_id: None, export_interval_ms: 0 }.
OtelConfig::with_session_id
get_sdk_version
"unknown" for an undecodable native string. Under runtime-linking, this is an SDK call that can trigger automatic library loading.