#[non_exhaustive]pub struct ApprovalRequestRecord {
pub request_id: String,
pub action: String,
pub summary: String,
pub details: Vec<u8>,
pub required_approvals: u32,
pub requested_by: String,
}Expand description
The accepted ApprovalRequest as it stands in serialized mode_state.
#[non_exhaustive] (0.8.0, DECISIONS.md D7), for the same reason as
the handoff records: mode-state records are persisted coordination state
that grows a field whenever a mode learns something new, and with all-pub
fields and no seal each added field is a constructible_struct_adds_field
major that release-plz.toml’s semver_check = true turns into a blocked
release PR across all seven lockstep crates. Sealing it once makes future
fields additive.
Unlike the handoff records this one does have a supported
external construction path, because it is a parameter of the public
QuorumMode::effective_threshold: start from Self::new and assign
whichever remaining fields you care about. They are all pub and
#[non_exhaustive] does not restrict field assignment — it refuses only
the struct-literal form.
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.request_id: String§action: String§summary: String§details: Vec<u8>§required_approvals: u32§requested_by: StringImplementations§
Source§impl ApprovalRequestRecord
impl ApprovalRequestRecord
Sourcepub fn new(
request_id: impl Into<String>,
required_approvals: u32,
) -> ApprovalRequestRecord
pub fn new( request_id: impl Into<String>, required_approvals: u32, ) -> ApprovalRequestRecord
Build a record carrying only the two fields a caller of
QuorumMode::effective_threshold must supply; assign any of the
remaining pub fields afterwards on a mut binding.
use macp_modes::mode::quorum::ApprovalRequestRecord;
let mut record = ApprovalRequestRecord::new("r1", 3);
record.action = "deploy.production".into();The runtime builds these itself from an accepted ApprovalRequest
envelope; this exists so the request-level
QuorumMode::effective_threshold stays callable from another crate
now that the struct is #[non_exhaustive]. It takes
required_approvals because that is the
only field threshold resolution reads, and
request_id because a record that identifies no
request is not a meaningful one; the rest are carried for the record’s
own sake and default to empty.
§Stability contract
This constructor’s arity never changes. A field added to
ApprovalRequestRecord is additive — that is the whole point of the
#[non_exhaustive] seal (DECISIONS.md D7) — and it stays additive
only if the seal’s one supported construction path stays additive too.
So a future field is reached by assignment, and if some future field
were ever genuinely mandatory it gets a new constructor rather than
a third parameter here. Widening this signature would be a
method_parameter_count_changed major (cargo-semver-checks does lint
inherent-method arity), i.e. it would block the release PR across all
seven lockstep crates — exactly the trap the seal was spent to escape.
Trait Implementations§
Source§impl Clone for ApprovalRequestRecord
impl Clone for ApprovalRequestRecord
Source§fn clone(&self) -> ApprovalRequestRecord
fn clone(&self) -> ApprovalRequestRecord
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 ApprovalRequestRecord
impl Debug for ApprovalRequestRecord
Source§impl<'de> Deserialize<'de> for ApprovalRequestRecord
impl<'de> Deserialize<'de> for ApprovalRequestRecord
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApprovalRequestRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApprovalRequestRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for ApprovalRequestRecord
impl Serialize for ApprovalRequestRecord
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ApprovalRequestRecord
impl RefUnwindSafe for ApprovalRequestRecord
impl Send for ApprovalRequestRecord
impl Sync for ApprovalRequestRecord
impl Unpin for ApprovalRequestRecord
impl UnsafeUnpin for ApprovalRequestRecord
impl UnwindSafe for ApprovalRequestRecord
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request