pub struct CardHint {
pub heading: Option<String>,
pub chat_heading: Option<String>,
pub money: Option<bool>,
pub reversibility: Option<Reversibility>,
pub offer_always: Option<bool>,
pub first_step: Option<String>,
pub detail: Option<CardDetail>,
pub media: Option<MediaFacts>,
}Expand description
What a feature says about one of its decisions (spec 3.3 §7.1). Every field is optional. When several hints answer the same decision, the first that sets a wording field wins, and any of them can mark money or remove Always allow.
§Example
use adk_surface::{CardDetail, CardHint, Reversibility};
let hint = CardHint::new()
.with_heading("Move News digest to 19:00")
.with_chat_heading("Snooze something in Coming up")
.with_reversibility(Reversibility::CanBeChangedBack)
.without_always_allow()
.with_first_step("Finance read 1 web page (example.com)");
assert_eq!(hint.offer_always, Some(false));
let workflow = CardHint::new()
.spends_money()
.with_detail(CardDetail::new("From the invoice-run workflow").with_link("Open in Runs", "/ui/runs/r-1"));
assert_eq!(workflow.money, Some(true));Fields§
§heading: Option<String>What will happen, in plain words, in place of the heading made from the call.
chat_heading: Option<String>The heading of a chat card, which carries no arguments (S-I5): “Snooze something in Coming up”.
money: Option<bool>Some(true) marks the call as spending money. Some(false) changes nothing.
reversibility: Option<Reversibility>Whether the call can be taken back.
offer_always: Option<bool>Some(false) removes Always allow. Some(true) changes nothing: whether it is
offered stays the source’s and the rules’ (§7.2).
first_step: Option<String>A step of “How it got here” before “Asked at 10:02”, such as “Finance read 1 web page (example.com)”.
detail: Option<CardDetail>A line under the details, such as “From the invoice-run workflow · Open in Runs”. Never on a chat card (S-I5).
media: Option<MediaFacts>What the feature knows about the images the call holds as evidence: where they go, what they are, the estimated cost and what they were cut from (spec 3.7 §8.2).
Implementations§
Source§impl CardHint
impl CardHint
Sourcepub fn with_heading(self, heading: impl Into<String>) -> Self
pub fn with_heading(self, heading: impl Into<String>) -> Self
Heads the card with heading.
Sourcepub fn with_chat_heading(self, heading: impl Into<String>) -> Self
pub fn with_chat_heading(self, heading: impl Into<String>) -> Self
Heads a chat card with heading.
Sourcepub fn spends_money(self) -> Self
pub fn spends_money(self) -> Self
Marks the call as spending money: the high-risk column, never Always allow.
Sourcepub fn with_reversibility(self, reversibility: Reversibility) -> Self
pub fn with_reversibility(self, reversibility: Reversibility) -> Self
Says whether the call can be taken back.
Sourcepub fn without_always_allow(self) -> Self
pub fn without_always_allow(self) -> Self
Removes Always allow from the card on every surface.
Sourcepub fn with_first_step(self, step: impl Into<String>) -> Self
pub fn with_first_step(self, step: impl Into<String>) -> Self
Adds step to “How it got here”, before “Asked at 10:02”.
Sourcepub fn with_detail(self, detail: CardDetail) -> Self
pub fn with_detail(self, detail: CardDetail) -> Self
Adds the line detail under the details.
Sourcepub fn with_media(self, media: MediaFacts) -> Self
pub fn with_media(self, media: MediaFacts) -> Self
Says what the call’s images are and where they go (spec 3.7 §8.2).
Trait Implementations§
impl Eq for CardHint
impl StructuralPartialEq for CardHint
Auto Trait Implementations§
impl Forget for CardHint
impl Freeze for CardHintwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
PhantomData<ImageFacts>: Freeze,
impl Move for CardHint
impl RefUnwindSafe for CardHint
impl Send for CardHintwhere
RawVecInner: Send,
impl Sync for CardHintwhere
RawVecInner: Sync,
impl Unpin for CardHint
impl UnsafeUnpin for CardHintwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<ImageFacts>: UnsafeUnpin,
impl UnwindSafe for CardHintwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 more