pub struct AskOptions {
pub css: Option<String>,
pub submit: String,
}Expand description
Options of ask.
Fields§
§css: Option<String>A stylesheet for the form.
submit: StringThe action that submits (default submit).
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 74)
73fn main() -> Result<(), tern_sdk::Error> {
74 let answer = tern_sdk::ask(view(), AskOptions::new().css(CSS))?;
75 match answer {
76 Answer::Submitted(submission) => {
77 let size = submission.values.get("size").and_then(|v| v.as_str());
78 match size {
79 Some(v) => println!("Size: {} ({v})", label(v)),
80 None => println!("No size picked."),
81 }
82 },
83 Answer::Cancelled => println!("Cancelled."),
84 Answer::Unsupported => ask_plainly()?,
85 }
86 Ok(())
87}Sourcepub fn css(self, css: impl Into<String>) -> Self
pub fn css(self, css: impl Into<String>) -> Self
Sets the stylesheet.
Examples found in repository?
examples/ask.rs (line 74)
73fn main() -> Result<(), tern_sdk::Error> {
74 let answer = tern_sdk::ask(view(), AskOptions::new().css(CSS))?;
75 match answer {
76 Answer::Submitted(submission) => {
77 let size = submission.values.get("size").and_then(|v| v.as_str());
78 match size {
79 Some(v) => println!("Size: {} ({v})", label(v)),
80 None => println!("No size picked."),
81 }
82 },
83 Answer::Cancelled => println!("Cancelled."),
84 Answer::Unsupported => ask_plainly()?,
85 }
86 Ok(())
87}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