Device capabilities (parts)

Parts give an app access to capabilities such as storage, networking, and device sensors through Rust APIs. They handle platform services independently of the app’s visual controls.

A part’s implementation is selected at compile time for the target operating system. Parts are Cargo dependencies and require no runtime plugin registry.

The UI snippets use generated res::str accessors from an app’s Fluent catalog; see the example messages and catalog setup.

The catalog

CrateWhat it doesReference
day-part-devicecharge level and charging statebattery
day-part-clipboardread/write the system clipboard (text)clipboard
day-part-preferencessmall key-value preference storage in the platform’s conventional locationprefs
day-part-filesystemapp-local file storage: read, write, remove, list (sync and async)fs
day-part-local-notifylocal notifications: post now or schedule, channels, tap-to-routenotify
day-part-keychainsmall secrets in the platform’s secure store, with a user-presence levelkeychain
day-part-biometricsthe platform’s own authentication prompt: biometrics or the device credentialbiometrics
day-part-connectivityconnectivity statusnetwork
day-part-devicedevice model, OS versiondeviceinfo
day-part-sensorsaccelerometer and friends, as a live streamsensors
day-part-httpHTTP through each platform’s networking stackhttp
day-part-permissionsask the OS for the camera, location, notifications … and declare them at build timepermissions
day-part-locationthe device’s position, once or as a live streamlocation
day-part-hapticshaptic feedbackhaptics
day-part-soundsound effectssound
day-part-wakelockkeeping the screen onwakelock
day-part-speechtext to speech through the system voicespeech
day-part-zeroconfdiscover and advertise local network servicesservice discovery
day-part-authexperimental account sign-in and native credential requestssign-in and passkeys

Select an API by its completion model

NeedEntry point and resultConstraint
Current battery readingday_part_device::battery::status() -> Option<BatteryStatus>Absence can mean no battery/API; inspect the returned fields
Small preferenceday::prefs::get(&str) -> Option<String>; set(&str, &str) -> boolSynchronous; the default facade feature supplies it; false/None can include failure
File dataday_part_filesystem::read_future(&str)Await a result; native blocking forms must stay off the UI thread
HTTP responseday_part_http::fetch_future(Request)Check transport errors and HTTP status separately
Permissionday_part_permissions::status_future(Permission)Await authoritative status; a grant does not establish hardware availability
NotificationNotification::post() -> Result<NotifId, NotifyError>Consent and channel setup are separate; success does not establish delivery

A part is a crate category, not a shared Part trait. There is no universal error or support contract: check each part’s capabilities, is_supported, optional value, or error result. OS selection often uses conditional compilation; some parts also depend on a live host bridge. Enabling a UI toolkit feature does not prove that all parts are available.

For callbacks requiring Send, pass result data through a Setter. For futures awaited inside day::task, update signals and format generated localized messages on the UI thread. Keep task and scope lifetimes explicit. See async ownership.

Complete tasks

Use the compile-designated HTTP, storage, permission, and notification recipes. Clipboard’s synchronous text helpers cannot express browser async permission behavior; consult the clipboard reference for its asynchronous content API.

Implement a part

A part can contribute native source, dependencies, and permissions through Cargo metadata. Follow the part tutorial, extension model, and bridge contract for implementation details. Inline bridge language arms are contributor material, not an additional app-facing Part interface.

Source review: part crates and facade feature gates, 2026-10-22. All catalog entries are available as Cargo dependencies. Guides include setup, platform limits, and links to their API reference. The sign-in reference describes the auth part’s setup and current limitations.