Skip to main content

ApprovalRequestRecord

Struct ApprovalRequestRecord 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: String

Implementations§

Source§

impl ApprovalRequestRecord

Source

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

Source§

fn clone(&self) -> ApprovalRequestRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApprovalRequestRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ApprovalRequestRecord

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ApprovalRequestRecord, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ApprovalRequestRecord

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more