pub enum MigrationStep {
SchemaDelta(Box<SchemaDeltaStep>),
Assertion {
contract: Box<AssertionStepContract>,
plan: Box<MigrationAssertionPlan>,
expected: AssertionExpectation,
},
}Expand description
Exact ordered migration step algebra. Trusted steps deliberately do not deserialize.
Variants§
SchemaDelta(Box<SchemaDeltaStep>)
One state-changing schema delta.
Assertion
One state-preserving verifier-derived assertion.
Fields
§
contract: Box<AssertionStepContract>Constructor-derived assertion contract.
§
plan: Box<MigrationAssertionPlan>Canonical typed assertion plan.
§
expected: AssertionExpectationClosed expected outcome.
Implementations§
Source§impl MigrationStep
impl MigrationStep
Sourcepub fn assertion(
id: MigrationStepId,
plan: MigrationAssertionPlan,
expected: AssertionExpectation,
) -> Result<Self, Diagnostic>
pub fn assertion( id: MigrationStepId, plan: MigrationAssertionPlan, expected: AssertionExpectation, ) -> Result<Self, Diagnostic>
Construct a trusted assertion step and derive all contract claims.
Sourcepub const fn kind(&self) -> MigrationStepKind
pub const fn kind(&self) -> MigrationStepKind
Return the closed step discriminator.
Sourcepub const fn id(&self) -> &MigrationStepId
pub const fn id(&self) -> &MigrationStepId
Return the unique step-local identity.
Sourcepub const fn required_capabilities(&self) -> &CapabilitySet
pub const fn required_capabilities(&self) -> &CapabilitySet
Return constructor-derived required capabilities.
Sourcepub fn as_schema_delta(&self) -> Option<&SchemaDeltaStep>
pub fn as_schema_delta(&self) -> Option<&SchemaDeltaStep>
Return a schema-delta step when this is state-changing.
Sourcepub fn as_assertion(
&self,
) -> Option<(&AssertionStepContract, &MigrationAssertionPlan, AssertionExpectation)>
pub fn as_assertion( &self, ) -> Option<(&AssertionStepContract, &MigrationAssertionPlan, AssertionExpectation)>
Return assertion contract, plan, and expectation when state-preserving.
Sourcepub fn validate(&self) -> Result<(), Diagnostic>
pub fn validate(&self) -> Result<(), Diagnostic>
Rebuild all derived claims and reject an assembled mismatched step.
Sourcepub fn canonical_bytes(&self) -> Result<Vec<u8>, Diagnostic>
pub fn canonical_bytes(&self) -> Result<Vec<u8>, Diagnostic>
Return exact canonical heterogeneous step bytes.
Trait Implementations§
Source§impl Clone for MigrationStep
impl Clone for MigrationStep
Source§fn clone(&self) -> MigrationStep
fn clone(&self) -> MigrationStep
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MigrationStep
impl Debug for MigrationStep
impl Eq for MigrationStep
Source§impl From<SchemaDeltaStep> for MigrationStep
impl From<SchemaDeltaStep> for MigrationStep
Source§fn from(step: SchemaDeltaStep) -> Self
fn from(step: SchemaDeltaStep) -> Self
Converts to this type from the input type.
Source§impl PartialEq for MigrationStep
impl PartialEq for MigrationStep
Source§impl Serialize for MigrationStep
impl Serialize for MigrationStep
impl StructuralPartialEq for MigrationStep
Auto Trait Implementations§
impl Freeze for MigrationStep
impl RefUnwindSafe for MigrationStep
impl Send for MigrationStep
impl Sync for MigrationStep
impl Unpin for MigrationStep
impl UnsafeUnpin for MigrationStep
impl UnwindSafe for MigrationStep
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
Mutably borrows from an owned value. Read more