pub enum TranscriptLine {
Alert {
title: String,
message: String,
icon: i32,
button: i32,
},
Beep(i32),
Response {
question: String,
title: String,
default_value: String,
label: String,
password: bool,
},
MailMsg {
ui: bool,
to: String,
cc: String,
bcc: String,
subject: String,
body: String,
},
Print {
ui: bool,
start: i32,
end: i32,
silent: bool,
shrink_to_fit: bool,
print_as_image: bool,
reverse: bool,
annotations: bool,
},
SubmitForm {
url: String,
data: Vec<u8>,
},
GotoPage(i32),
NamedAction(String),
ConsolePrintln(String),
FunctionAlert {
caller: String,
message: String,
},
}javascript only.Expand description
One thing a script asked the host to do.
Ten shapes, because the goldens carry ten. Each variant’s render output
is quoted from the callback that produces it.
Variants§
Alert
app.alert — 1933 of the 2004 golden lines.
The message is printed with a conditional decoration: see
TranscriptLine::render.
Fields
nType, defaulting to 0.
Beep(i32)
app.beep(n) — ExampleAppBeep.
Response
app.response(...) — ExampleAppResponse. The host answers with the
empty string; nothing is prompted.
Fields
MailMsg
app.mailMsg / Doc.mailDoc / Doc.mailForm — ExampleDocMail.
Nothing is sent: no network, no MAPI, no process spawn.
Fields
Doc.print — ExampleDocPrint. Nothing is printed.
Fields
SubmitForm
Doc.submitForm — ExampleDocSubmitForm.
The most dangerous entry point in the object model, and the one where “hand back the data, do not act on it” matters most. No request is made; the URL and the bytes come back here for a host to decide about.
GotoPage(i32)
Doc.gotoNamedDest and page navigation — ExampleDocGotoPage.
NamedAction(String)
A named action fired from a non-JavaScript callback —
ExampleNamedAction. named_action.in is its one fixture.
ConsolePrintln(String)
console.println. The oracle discards it, so this variant renders
to nothing and is carried only so a host can see what a script
logged.
FunctionAlert
An AF* function’s own alert, which is not routed through app.alert.
The function’s own name is the title, always with icon = 3 and
button = 0 — so these render in the decorated form and appear
unprefixed by Alert:, interleaved with the plain lines. Getting
that interleaving right is a scoring requirement.
Implementations§
Source§impl TranscriptLine
impl TranscriptLine
Sourcepub fn render(&self) -> Option<String>
pub fn render(&self) -> Option<String>
The line the oracle would print, without its newline.
None for a shape that prints nothing — TranscriptLine::ConsolePrintln
alone, because the oracle’s console methods are empty.
§The alert decoration is conditional, and it is exact
Three forms, chosen by what differs from the default:
| condition | line |
|---|---|
| default title, icon and type | Alert: <msg> |
| non-default title only | <title>: <msg> |
| non-default icon or type | <title>[icon=N,type=N]: <msg> |
An AF* alert always takes the third form with icon=3,type=0, so it
reads AFNumber_Keystroke[icon=3,type=0]: The input value is invalid.
with no Alert: prefix.
Sourcepub fn alert(message: impl Into<String>) -> TranscriptLine
pub fn alert(message: impl Into<String>) -> TranscriptLine
A default-decoration alert: the shape 1922 of the 2004 golden lines take.
Trait Implementations§
Source§impl Clone for TranscriptLine
impl Clone for TranscriptLine
Source§impl Debug for TranscriptLine
impl Debug for TranscriptLine
impl Eq for TranscriptLine
Source§impl PartialEq for TranscriptLine
impl PartialEq for TranscriptLine
impl StructuralPartialEq for TranscriptLine
Auto Trait Implementations§
impl Freeze for TranscriptLine
impl RefUnwindSafe for TranscriptLine
impl Send for TranscriptLine
impl Sync for TranscriptLine
impl Unpin for TranscriptLine
impl UnsafeUnpin for TranscriptLine
impl UnwindSafe for TranscriptLine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.