pub struct Proposal {
pub attachment_id: AttachmentId,
pub fields: Vec<ProposedField>,
}Expand description
Values derived from one document and awaiting review.
This is the “proposed values awaiting review” concept, in the only place it belongs: the domain’s own state. The framework’s view does not need a word for it, because everything the shape requires — an obligation per field, a notice naming the document, a card bound to the proposal, an act that edits a proposal distinct from the act that answers it — is expressible without one.
Fields§
§attachment_id: AttachmentIdThe document the values were read from.
fields: Vec<ProposedField>The proposed values, in ClaimField::ALL order.
Implementations§
Source§impl Proposal
impl Proposal
Sourcepub fn new(attachment_id: AttachmentId, fields: Vec<ProposedField>) -> Self
pub fn new(attachment_id: AttachmentId, fields: Vec<ProposedField>) -> Self
Builds a proposal, ordering the fields canonically.
The order is normalized here rather than trusted from the caller so two extractions that found the same values hash the same, which is what makes the card’s payload hash meaningful.
Sourcepub fn field(&self, field: ClaimField) -> Option<&ProposedField>
pub fn field(&self, field: ClaimField) -> Option<&ProposedField>
The proposed value for a field, when there is one.
Sourcepub fn missing(&self) -> Vec<ClaimField>
pub fn missing(&self) -> Vec<ClaimField>
Required fields this proposal does not carry, in a stable order.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true when every required field has a proposed value.
Sourcepub fn edited_count(&self) -> usize
pub fn edited_count(&self) -> usize
How many values the user changed before answering.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Proposal
impl<'de> Deserialize<'de> for Proposal
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 Proposal
impl StructuralPartialEq for Proposal
Auto Trait Implementations§
impl Freeze for Proposal
impl RefUnwindSafe for Proposal
impl Send for Proposal
impl Sync for Proposal
impl Unpin for Proposal
impl UnsafeUnpin for Proposal
impl UnwindSafe for Proposal
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.