Skip to main content

FlowContract

Struct FlowContract 

Source
pub struct FlowContract {
    pub id: ContractId,
    pub version: u32,
    pub input: &'static str,
    pub output: &'static str,
}
Expand description

The mechanically comparable part of a data-flow contract. 数据流合同中可以机械比较的部分。

Fields§

§id: ContractId

Slot this contract describes. 本合同描述的插槽。

§version: u32

Contract version; it must match exactly for either comparison to pass. 合同版本;两种比较都要求它完全一致。

§input: &'static str

Declared type label of the contract input. 合同输入端声明的类型标签。

§output: &'static str

Declared type label of the contract output. 合同输出端声明的类型标签。

Implementations§

Source§

impl FlowContract

Source

pub const NONE: FlowContract

The undeclared static contract: empty id, version 0, empty labels. 未声明的编译期合同:id 为空、版本为 0、标签为空。

Source

pub const fn new( id: ContractId, version: u32, input: &'static str, output: &'static str, ) -> FlowContract

Build a declared contract from its slot, version, and two type labels. 由插槽、版本与两个类型标签构造一份已声明合同。

Source

pub const fn is_declared(self) -> bool

Whether a slot id was declared; the compiled twin of the owned check. 是否声明了插槽 id;owned 检查的编译期孪生。

Source

pub fn compatible_with(self, expected: FlowContract) -> bool

Whether the two contracts are literally the same wire contract. 两份合同字面上是否是同一个线上合同。

This is the literal half of the comparison pair. Spelling differences in known semantic domains are handled by FlowContract::semantically_compatible_with, not here, so a caller that means “same domain” must call that method. 这是比较对中的字面一半。已知语义域里的拼写差异由 FlowContract::semantically_compatible_with 处理,不在本方法;因此想要 “同一语义域“的调用方必须调用那个方法。

Source

pub fn input_semantic(self) -> FlowSemantic

Normalized semantic domain of the declared input label. 声明的输入标签所归入的语义域。

Source

pub fn output_semantic(self) -> FlowSemantic

Normalized semantic domain of the declared output label. 声明的输出标签所归入的语义域。

Source

pub fn semantically_compatible_with(self, expected: FlowContract) -> bool

Compare both the wire type and its known semantic domain. 同时比较线上的类型名称和已知语义域。

Trait Implementations§

Source§

impl Clone for FlowContract

Source§

fn clone(&self) -> FlowContract

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 Copy for FlowContract

Source§

impl Debug for FlowContract

Source§

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

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

impl Eq for FlowContract

Source§

impl From<FlowContract> for OwnedFlowContract

Source§

fn from(contract: FlowContract) -> OwnedFlowContract

Converts to this type from the input type.
Source§

impl PartialEq for FlowContract

Source§

fn eq(&self, other: &FlowContract) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FlowContract

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.