pub struct AskOptions {
pub css: Option<String>,
pub submit: String,
pub font: Option<Font>,
}Expand description
Options of ask.
Fields§
§css: Option<String>A stylesheet for the form.
submit: StringThe action that submits (default submit).
font: Option<Font>The surface’s base face (default mono; Font::Sans for forms).
Implementations§
Source§impl AskOptions
impl AskOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
No stylesheet, submitted by submit.
Examples found in repository?
examples/ask.rs (line 70)
69fn main() -> Result<(), tern_sdk::Error> {
70 let answer = tern_sdk::ask(view(), AskOptions::new().font(Font::Sans))?;
71 match answer {
72 Answer::Submitted(submission) => {
73 let size = submission.values.get("size").and_then(|v| v.as_str());
74 match size {
75 Some(v) => println!("Size: {} ({v})", label(v)),
76 None => println!("No size picked."),
77 }
78 },
79 Answer::Cancelled => println!("Cancelled."),
80 Answer::Unsupported => ask_plainly()?,
81 }
82 Ok(())
83}Sourcepub const fn font(self, font: Font) -> Self
pub const fn font(self, font: Font) -> Self
Sets the surface’s base face.
Examples found in repository?
examples/ask.rs (line 70)
69fn main() -> Result<(), tern_sdk::Error> {
70 let answer = tern_sdk::ask(view(), AskOptions::new().font(Font::Sans))?;
71 match answer {
72 Answer::Submitted(submission) => {
73 let size = submission.values.get("size").and_then(|v| v.as_str());
74 match size {
75 Some(v) => println!("Size: {} ({v})", label(v)),
76 None => println!("No size picked."),
77 }
78 },
79 Answer::Cancelled => println!("Cancelled."),
80 Answer::Unsupported => ask_plainly()?,
81 }
82 Ok(())
83}Trait Implementations§
Source§impl Clone for AskOptions
impl Clone for AskOptions
Source§impl Debug for AskOptions
impl Debug for AskOptions
Auto Trait Implementations§
impl Freeze for AskOptions
impl RefUnwindSafe for AskOptions
impl Send for AskOptions
impl Sync for AskOptions
impl Unpin for AskOptions
impl UnsafeUnpin for AskOptions
impl UnwindSafe for AskOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more