pub struct OperationSpec { /* private fields */ }Expand description
Product-neutral catalog record for one operation.
Implementations§
Source§impl OperationSpec
impl OperationSpec
Sourcepub fn new(
name: OperationName,
target_kind: TargetKind,
access: AccessClass,
) -> Self
pub fn new( name: OperationName, target_kind: TargetKind, access: AccessClass, ) -> Self
Creates a minimal version-one specification.
Sourcepub fn with_schema_version(self, schema_version: u32) -> Self
pub fn with_schema_version(self, schema_version: u32) -> Self
Sets the serialized contract version.
Sourcepub fn with_schema_ids(
self,
parameter_schema: SchemaId,
result_schema: SchemaId,
) -> Self
pub fn with_schema_ids( self, parameter_schema: SchemaId, result_schema: SchemaId, ) -> Self
Sets explicit parameter and result schema identities.
Sourcepub fn with_diagnostic_code(self, code: DiagnosticCode) -> Self
pub fn with_diagnostic_code(self, code: DiagnosticCode) -> Self
Declares a stable diagnostic code that the operation may emit.
Sourcepub fn with_safety(self, risk: RiskClass, reversibility: Reversibility) -> Self
pub fn with_safety(self, risk: RiskClass, reversibility: Reversibility) -> Self
Sets risk and reversibility metadata.
Sourcepub fn with_required(self, required: ParameterGroup) -> Self
pub fn with_required(self, required: ParameterGroup) -> Self
Sets fields required for every request.
Sourcepub fn with_required_any(self, group: ParameterGroup) -> Self
pub fn with_required_any(self, group: ParameterGroup) -> Self
Adds an alternative complete parameter group.
Sourcepub fn with_lifecycle(
self,
planning: CapabilitySupport,
progress: CapabilitySupport,
cancellation: CapabilitySupport,
verification: CapabilitySupport,
fanout: CapabilitySupport,
) -> Self
pub fn with_lifecycle( self, planning: CapabilitySupport, progress: CapabilitySupport, cancellation: CapabilitySupport, verification: CapabilitySupport, fanout: CapabilitySupport, ) -> Self
Sets lifecycle and fanout capability support.
Sourcepub fn with_retry(self, retry: RetryClass, idempotent: bool) -> Self
pub fn with_retry(self, retry: RetryClass, idempotent: bool) -> Self
Sets retry behavior and whether mutations are idempotent.
Sourcepub fn with_evidence(self, evidence: EvidenceKind) -> Self
pub fn with_evidence(self, evidence: EvidenceKind) -> Self
Adds an evidence kind returned by the operation.
Sourcepub fn with_requirement(
self,
requirement: impl Into<String>,
) -> Result<Self, SpecError>
pub fn with_requirement( self, requirement: impl Into<String>, ) -> Result<Self, SpecError>
Adds an implementation capability requirement such as transport.ssh.
Sourcepub fn validate(&self) -> Result<(), SpecError>
pub fn validate(&self) -> Result<(), SpecError>
Validates cross-field safety and compatibility invariants.
Sourcepub fn name(&self) -> &OperationName
pub fn name(&self) -> &OperationName
Returns the canonical operation name.
Sourcepub const fn schema_version(&self) -> u32
pub const fn schema_version(&self) -> u32
Returns the contract schema version.
Sourcepub fn parameter_schema(&self) -> &SchemaId
pub fn parameter_schema(&self) -> &SchemaId
Returns the versioned parameter schema identity.
Sourcepub fn result_schema(&self) -> &SchemaId
pub fn result_schema(&self) -> &SchemaId
Returns the versioned result schema identity.
Sourcepub fn diagnostic_codes(&self) -> impl Iterator<Item = &DiagnosticCode>
pub fn diagnostic_codes(&self) -> impl Iterator<Item = &DiagnosticCode>
Iterates over stable diagnostic codes declared by the operation.
Sourcepub fn allows_diagnostic(&self, code: &DiagnosticCode) -> bool
pub fn allows_diagnostic(&self, code: &DiagnosticCode) -> bool
Returns whether the operation contract declares this diagnostic code.
Sourcepub fn target_kind(&self) -> &TargetKind
pub fn target_kind(&self) -> &TargetKind
Returns the required target kind.
Sourcepub const fn access(&self) -> AccessClass
pub const fn access(&self) -> AccessClass
Returns the access class.
Sourcepub const fn reversibility(&self) -> Reversibility
pub const fn reversibility(&self) -> Reversibility
Returns expected reversibility.
Sourcepub fn required(&self) -> &ParameterGroup
pub fn required(&self) -> &ParameterGroup
Returns fields required for every request.
Sourcepub fn required_any(&self) -> &[ParameterGroup]
pub fn required_any(&self) -> &[ParameterGroup]
Returns alternative complete parameter groups.
Sourcepub const fn planning(&self) -> CapabilitySupport
pub const fn planning(&self) -> CapabilitySupport
Returns planning support.
Sourcepub const fn progress(&self) -> CapabilitySupport
pub const fn progress(&self) -> CapabilitySupport
Returns progress support.
Sourcepub const fn cancellation(&self) -> CapabilitySupport
pub const fn cancellation(&self) -> CapabilitySupport
Returns cancellation support.
Sourcepub const fn verification(&self) -> CapabilitySupport
pub const fn verification(&self) -> CapabilitySupport
Returns verification support.
Sourcepub const fn fanout(&self) -> CapabilitySupport
pub const fn fanout(&self) -> CapabilitySupport
Returns fanout support.
Sourcepub const fn retry(&self) -> RetryClass
pub const fn retry(&self) -> RetryClass
Returns retry classification.
Sourcepub const fn idempotent(&self) -> bool
pub const fn idempotent(&self) -> bool
Returns whether mutation repetition is idempotent.
Sourcepub fn evidence(&self) -> impl Iterator<Item = &EvidenceKind>
pub fn evidence(&self) -> impl Iterator<Item = &EvidenceKind>
Iterates over expected evidence kinds.
Sourcepub fn requirements(&self) -> impl Iterator<Item = &str>
pub fn requirements(&self) -> impl Iterator<Item = &str>
Iterates over implementation capability requirements.
Trait Implementations§
Source§impl Clone for OperationSpec
impl Clone for OperationSpec
Source§fn clone(&self) -> OperationSpec
fn clone(&self) -> OperationSpec
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 OperationSpec
impl Debug for OperationSpec
Source§impl<'de> Deserialize<'de> for OperationSpec
impl<'de> Deserialize<'de> for OperationSpec
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>,
Source§impl JsonSchema for OperationSpec
impl JsonSchema for OperationSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for OperationSpec
impl PartialEq for OperationSpec
Source§fn eq(&self, other: &OperationSpec) -> bool
fn eq(&self, other: &OperationSpec) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for OperationSpec
impl Serialize for OperationSpec
impl Eq for OperationSpec
impl StructuralPartialEq for OperationSpec
Auto Trait Implementations§
impl Freeze for OperationSpec
impl RefUnwindSafe for OperationSpec
impl Send for OperationSpec
impl Sync for OperationSpec
impl Unpin for OperationSpec
impl UnsafeUnpin for OperationSpec
impl UnwindSafe for OperationSpec
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.