backgroundassets-rs
Safe Rust bindings for Apple's BackgroundAssets framework — on-demand asset packs, manifest parsing, managed asset-pack availability, downloader-extension bridging, and URL download descriptors on macOS.
Status: v0.3.0 adds direct
BADownloadManagerDelegateandBAManagedAssetPackDownloadDelegatewrappers, the self-hosted managed-extension principal class, and typedManagedBackgroundAssetsErrorsupport alongside the executor-agnosticasync_apimodule.
Quick start
= { = "0.3", = ["async"] }
use AsyncAssetPackManager;
use AssetPackStatus;
Feature table
| Area | Surface |
|---|---|
| Asset packs | AssetPack, AssetPackStatus, Manifest, AssetPackManager |
| Downloads | Download, UrlDownload, DownloadManager, DownloadManagerDelegate, DownloadManagerEvent, DownloadPriority, DownloadStatus |
| Managed delegates | ManagedAssetPackDownloadDelegate, ManagedAssetPackDownloadEvent, ManagedBackgroundAssetsError, ManagedBackgroundAssetsErrorCode |
| Extension metadata | AppExtensionInfo, AuthenticationChallenge, ChallengeDisposition |
| Async workflows | async_api::{AsyncAssetPackManager, AsyncDownloadManager}, status-update streams, direct delegate event streams, and managed-extension registration (requires async) |
| Rust-hosted extension | install_global_downloader_extension, install_global_managed_downloader_extension, and Swift principal classes BackgroundAssetsRustDownloaderExtension / BackgroundAssetsRustManagedDownloaderExtension |
Highlights
- Safe wrappers for
AssetPack,Manifest,Download,UrlDownload,DownloadManager,AssetPackManager, andBAAppExtensionInfo. - Direct
BADownloadManagerDelegateandBAManagedAssetPackDownloadDelegatecoverage via Rust traits, installer helpers, and bounded async event streams. - Executor-agnostic async wrappers in
async_api, backed by SwiftTaskthunks anddoom-fish-utils::completion::AsyncCompletion. - Rust-side principal classes for both
BADownloaderExtensionand self-hostedManagedDownloaderExtensionflows. - Typed managed-error support layered on
BackgroundAssetsError, preserving the framework domain, numeric code, message, asset-pack identifier, and file path metadata.
Examples
All examples require the async feature:
01_list_pack_status02_download_pack03_extension_handler04_async_download05_managed_extension_handler
Run them with:
Availability
- The crate targets the Background Assets surface shipped in the macOS 26 SDK.
BADownload,BAURLDownload, andBADownloadManagerare available on earlier macOS releases in the Apple SDK, but the managed asset-pack surface (AssetPack,Manifest,AssetPackManager, managed delegates, and the managed principal class) requires macOS 26.AssetPackManager::status_relative_to,local_status,asset_pack_is_available_locally, andensure_local_availability(..., require_latest = true)require macOS 26.4 at runtime because that is where Apple introduced those APIs.
Extension integration
The Swift bridge exports two ready-to-use principal classes:
BackgroundAssetsRustDownloaderExtensionfor the standardBADownloaderExtensionflow.BackgroundAssetsRustManagedDownloaderExtensionfor the macOS 26 self-hostedManagedDownloaderExtensionflow.
Use the standard class with install_global_downloader_extension(...).
Use the managed class with install_global_managed_downloader_extension(...), which also registers the managed download-manager delegate configuration expected by the self-hosted path.
For direct delegate observation outside the extension principal class, use:
install_global_download_manager_delegate(...)install_global_managed_asset_pack_download_delegate(...)
See examples/03_extension_handler.rs and examples/05_managed_extension_handler.rs for the Rust side of the pattern.
Coverage
See COVERAGE.md and COVERAGE_AUDIT.md for the audited SDK surface and full macOS 26.5 coverage summary.
License
Licensed under either Apache-2.0 or MIT at your option.