pub struct Draft {
pub action_label: String,
pub resource_label: String,
pub description: Option<String>,
pub layout: DraftLayout,
pub fields: Vec<DraftField>,
pub undoable: bool,
}Expand description
An invocation as a person reviews it.
Fields§
§action_label: String§resource_label: String§description: Option<String>§layout: DraftLayout§fields: Vec<DraftField>§undoable: boolWhether the action, once taken, can be undone
(ActionContract::can_be_undone):
a reviewer is told whether it sends something away or changes their
own work.
Implementations§
Source§impl Draft
impl Draft
pub fn render( descriptor: &ActionDescriptor, arguments: &Map<String, Value>, ) -> Self
pub fn role(&self, role: MessageRole) -> Option<&DraftField>
Sourcepub fn shown_line(field: &DraftField) -> String
pub fn shown_line(field: &DraftField) -> String
What a person reads in field’s one line: the label it shows where
the value names a choice, its value otherwise.
Sourcepub fn gist(&self) -> Option<String>
pub fn gist(&self) -> Option<String>
What the draft is about, in one line of its own values: a message’s
recipients and subject, otherwise its first short values. None for a
draft with nothing to show.
Sourcepub fn summary(&self) -> Vec<(String, String)>
pub fn summary(&self) -> Vec<(String, String)>
Each field as one line a reviewer reads at a glance, by its label:
a long value cut at SUMMARY_CHARS with an ellipsis, a secret
withheld.
Sourcepub fn apply_edits(
&self,
arguments: &Map<String, Value>,
edits: &[DraftEdit],
) -> Result<Map<String, Value>, String>
pub fn apply_edits( &self, arguments: &Map<String, Value>, edits: &[DraftEdit], ) -> Result<Map<String, Value>, String>
arguments with the person’s edits applied. Only fields this draft
offers for editing change, each keeping its JSON type.
Sourcepub fn check_edits(&self, edits: &[DraftEdit]) -> Result<(), String>
pub fn check_edits(&self, edits: &[DraftEdit]) -> Result<(), String>
Whether every one of edits changes a field this draft offers for
editing to a value of its type.
Sourcepub fn arguments(&self) -> Option<Map<String, Value>>
pub fn arguments(&self) -> Option<Map<String, Value>>
The arguments this draft shows: each text, number and flag field set
at its path. None when a field shows its value only in part (a
secret, a list, a resource, a text cut short). A draft also leaves
out nulls and empty texts, so what this returns is only a candidate:
act on it only when it digests (arguments_digest) to the digest
the draft was confirmed for.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Draft
impl<'de> Deserialize<'de> for Draft
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Draft
impl StructuralPartialEq for Draft
Auto Trait Implementations§
impl Forget for Draft
impl Freeze for Draft
impl Move for Draft
impl RefUnwindSafe for Draft
impl Send for Draft
impl Sync for Draft
impl Unpin for Draft
impl UnsafeUnpin for Draft
impl UnwindSafe for Draft
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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