pub enum Effect<X = NoEffect> {
Show 14 variants
Http {
method: String,
path: String,
body: Option<Value>,
auth: bool,
headers: BTreeMap<String, String>,
},
Timer {
after_ms: u64,
},
CancelTimer {
timer_id: u64,
},
Store {
key: String,
value: Option<Value>,
},
Secure {
key: String,
value: Option<String>,
},
Random {
n: u32,
},
Navigate {
op: NavigateOp,
url: String,
},
OpenAuthBrowser {
url: String,
},
Reload {},
LoadBlob {
name: String,
},
Span {
name: String,
ms: u64,
tags: BTreeMap<String, String>,
},
Log {
level: String,
msg: String,
},
Report {
error: String,
},
App(X),
}Expand description
A capability the shell implements. The built-in set is small and universal; anything else
(haptics, sound, share sheets, push registration, review prompts) is the app’s own effect type
X, carried by Effect::App and serialized flat next to the built-ins, so a shell
matches on one key: {"id":3,"Http":{...}} or {"id":4,"Vibrate":{"ms":20}}.
Unit-like variants are empty structs so they stay JSON objects and flatten next to the request id.
Variants§
Http
Fields
Timer
Resolves with {"fired":true} after after_ms.
CancelTimer
Store
Set when value is present, otherwise read (resolves with the value or null).
Secure
Like Store for secrets: Keychain / Keystore on native, never plain browser storage.
Random
Resolves with n random bytes as a hex string.
Change the address / screen stack.
OpenAuthBrowser
Open the sign-in page in a system browser session. Resolves with the callback URL.
Reload
Web only: reload the page to fetch the latest bundle.
LoadBlob
The shell fetches the named blob and calls provide_blob(name, bytes).
Span
A timing for telemetry. Fire and forget: the shell reports a span of ms named name.
Log
Fire and forget.
Report
Fire and forget: send an error to the shell’s error tracker.
App(X)
An effect the app defined.