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: ContractIdSlot this contract describes. 本合同描述的插槽。
version: u32Contract version; it must match exactly for either comparison to pass. 合同版本;两种比较都要求它完全一致。
input: &'static strDeclared type label of the contract input. 合同输入端声明的类型标签。
output: &'static strDeclared type label of the contract output. 合同输出端声明的类型标签。
Implementations§
Source§impl FlowContract
impl FlowContract
Sourcepub const NONE: FlowContract
pub const NONE: FlowContract
The undeclared static contract: empty id, version 0, empty labels. 未声明的编译期合同:id 为空、版本为 0、标签为空。
Sourcepub const fn new(
id: ContractId,
version: u32,
input: &'static str,
output: &'static str,
) -> FlowContract
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. 由插槽、版本与两个类型标签构造一份已声明合同。
Sourcepub const fn is_declared(self) -> bool
pub const fn is_declared(self) -> bool
Whether a slot id was declared; the compiled twin of the owned check. 是否声明了插槽 id;owned 检查的编译期孪生。
Sourcepub fn compatible_with(self, expected: FlowContract) -> bool
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 处理,不在本方法;因此想要
“同一语义域“的调用方必须调用那个方法。
Sourcepub fn input_semantic(self) -> FlowSemantic
pub fn input_semantic(self) -> FlowSemantic
Normalized semantic domain of the declared input label. 声明的输入标签所归入的语义域。
Sourcepub fn output_semantic(self) -> FlowSemantic
pub fn output_semantic(self) -> FlowSemantic
Normalized semantic domain of the declared output label. 声明的输出标签所归入的语义域。
Sourcepub fn semantically_compatible_with(self, expected: FlowContract) -> bool
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
impl Clone for FlowContract
Source§fn clone(&self) -> FlowContract
fn clone(&self) -> FlowContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more