#[non_exhaustive]pub struct BodySectionPatch {
pub context: Option<String>,
pub decision: Option<String>,
pub consequences: Option<String>,
}Expand description
Selects which ADR body sections to patch on Repository::update.
None for a field means leave that section’s on-disk bytes untouched.
Some(text) replaces the targeted portion (for MADR 4.0.0 ## Decision Outcome,
only the intro before ### subsections unless consequences is also set).
§Migration from pre-BodySectionPatch update(&adr)
The previous Repository::update(&adr) re-rendered body sections from
adr.context / adr.decision / adr.consequences. An empty
BodySectionPatch::default() does not do that: it only updates
metadata. To change body text, put the new content in the corresponding
patch field; values on adr alone are ignored for body content.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.context: Option<String>Patch the context section (## Context / ## Context and Problem Statement).
decision: Option<String>Patch the decision intro (## Decision / ## Decision Outcome body before H3 subsections).
consequences: Option<String>Patch consequences (## Consequences, or MADR ### Consequences under Decision Outcome).
Implementations§
Source§impl BodySectionPatch
impl BodySectionPatch
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty patch (metadata-only when passed to Repository::update).
Sourcepub fn with_context(self, text: impl Into<String>) -> Self
pub fn with_context(self, text: impl Into<String>) -> Self
Set the context section patch.
Sourcepub fn with_decision(self, text: impl Into<String>) -> Self
pub fn with_decision(self, text: impl Into<String>) -> Self
Set the decision section patch.
Sourcepub fn with_consequences(self, text: impl Into<String>) -> Self
pub fn with_consequences(self, text: impl Into<String>) -> Self
Set the consequences section patch.
Trait Implementations§
Source§impl Clone for BodySectionPatch
impl Clone for BodySectionPatch
Source§fn clone(&self) -> BodySectionPatch
fn clone(&self) -> BodySectionPatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BodySectionPatch
impl Debug for BodySectionPatch
Source§impl Default for BodySectionPatch
impl Default for BodySectionPatch
Source§fn default() -> BodySectionPatch
fn default() -> BodySectionPatch
impl Eq for BodySectionPatch
Source§impl PartialEq for BodySectionPatch
impl PartialEq for BodySectionPatch
impl StructuralPartialEq for BodySectionPatch
Auto Trait Implementations§
impl Freeze for BodySectionPatch
impl RefUnwindSafe for BodySectionPatch
impl Send for BodySectionPatch
impl Sync for BodySectionPatch
impl Unpin for BodySectionPatch
impl UnsafeUnpin for BodySectionPatch
impl UnwindSafe for BodySectionPatch
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§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.