pub enum PresentSpec {
Dialog {
title: String,
message: Option<String>,
buttons: Vec<PresentButton>,
sheet: bool,
},
Prompt {
title: String,
message: Option<String>,
placeholder: String,
initial: String,
ok: String,
cancel: String,
},
OpenFile {
title: String,
filters: Vec<FileFilter>,
},
SaveFile {
title: String,
suggested_name: String,
src_path: String,
filters: Vec<FileFilter>,
},
}Expand description
What a backend should present for a req. Kept toolkit-agnostic; the pieces layer
maps a chosen button index back to a typed payload.
Variants§
Dialog
Alert / confirmation / action sheet: title + optional message + ordered buttons.
sheet = present from the bottom on mobile (desktop falls back to an alert).
Prompt
A dialog with a single text field.
Fields
OpenFile
Native “open file” picker (docs/files.md). The backend must answer with
PresentResult::Files whose entries are readable local paths — desktop returns
the chosen path directly; iOS/Android copy the selection into app storage first, so
the pieces layer can read it with std::fs regardless of platform.
SaveFile
Native “save file” picker (docs/files.md). src_path is a Day-written temp file
holding the bytes to save; iOS/Android deliver it to the chosen destination natively,
and the pieces layer best-effort copies it to a chosen local path otherwise.
Implementations§
Source§impl PresentSpec
impl PresentSpec
Sourcepub fn title(&self) -> &str
pub fn title(&self) -> &str
Backend-facing flattening for the C ABI: (title, message, button labels, button roles as ints, sheet-or-prompt fields). Pure-Rust backends read the enum directly.
pub fn message(&self) -> Option<&str>
Button labels joined with the unit separator (0x1f) — the encoding the nav menu and combobox shims already use for string lists.
Sourcepub fn roles_joined(&self) -> String
pub fn roles_joined(&self) -> String
Button roles as ints (0 default, 1 cancel, 2 destructive), joined with commas.
Sourcepub fn filters(&self) -> &[FileFilter]
pub fn filters(&self) -> &[FileFilter]
The file filters, if this is a file dialog.
Sourcepub fn suggested_name(&self) -> &str
pub fn suggested_name(&self) -> &str
The suggested file name for a save dialog (empty otherwise).
Sourcepub fn src_path(&self) -> &str
pub fn src_path(&self) -> &str
The Day-written temp source path for a save dialog (empty otherwise).
Sourcepub fn filters_joined(&self) -> String
pub fn filters_joined(&self) -> String
Filters flattened for the C ABI: each filter is name|ext1,ext2, joined by the unit
separator. A trailing | (no extensions) means “all files”. Empty when unfiltered.
Trait Implementations§
Source§impl Clone for PresentSpec
impl Clone for PresentSpec
Source§fn clone(&self) -> PresentSpec
fn clone(&self) -> PresentSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PresentSpec
impl Debug for PresentSpec
Source§impl PartialEq for PresentSpec
impl PartialEq for PresentSpec
Source§fn eq(&self, other: &PresentSpec) -> bool
fn eq(&self, other: &PresentSpec) -> bool
self and other values to be equal, and is used by ==.