pub struct OwnedFlowContract {
pub id: String,
pub version: u32,
pub input: String,
pub output: String,
}Expand description
Owned flow contract used by file-backed snapshots. 文件快照使用的拥有型数据流合同。
Compiled declarations keep static strings. Reloaded source owns its strings, so replacing a file does not leak old contracts. 编译期声明继续使用静态字符串;热重载源码拥有自己的字符串,替换文件时不会泄漏旧合同。
Fields§
§id: StringTarget slot; the owned snapshot’s twin of FlowContract::id.
目标插槽;owned 快照中对应 FlowContract::id 的一侧。
version: u32Contract version; the owned twin of FlowContract::version.
合同版本;FlowContract::version 的 owned 孪生。
input: StringDeclared input label; the owned twin of FlowContract::input.
声明的输入标签;FlowContract::input 的 owned 孪生。
output: StringDeclared output label; the owned twin of FlowContract::output.
声明的输出标签;FlowContract::output 的 owned 孪生。
Implementations§
Source§impl OwnedFlowContract
impl OwnedFlowContract
Sourcepub fn none() -> OwnedFlowContract
pub fn none() -> OwnedFlowContract
The undeclared owned contract: empty strings and version zero. 未声明的 owned 合同:字符串为空、版本为 0。
Examples found in repository?
36fn snapshot(namespace: &str, index: usize, parent: NodeId) -> RegistrationSnapshot {
37 let kind = format!("Face{index}");
38 RegistrationSnapshot {
39 namespace: namespace.to_owned(),
40 id: NodeId::from_namespaced_path(namespace, &format!("scale/{index}.rs"), &kind),
41 parent,
42 kind: kind.clone(),
43 preset: "default".to_owned(),
44 parts: String::new(),
45 params: String::new(),
46 handle: kind.clone(),
47 stable_name: None,
48 name: OwnedLocalizedText {
49 zh: kind.clone(),
50 en: kind.clone(),
51 },
52 summary: OwnedLocalizedText {
53 zh: String::new(),
54 en: String::new(),
55 },
56 exports: Vec::new(),
57 needs_registry: false,
58 registry_name: format!("face-{index}"),
59 getting_from_other_registry: None,
60 registry_rule_path: "<scale-audit>".to_owned(),
61 registry_rule: OwnedRegistrationRule {
62 required_preset: None,
63 required_parts: Vec::new(),
64 required_exports: Vec::new(),
65 required_handle_traits: Vec::new(),
66 required_part_traits: Vec::new(),
67 },
68 admission: OwnedAdmission {
69 allowed_paths: Vec::new(),
70 denied_paths: Vec::new(),
71 },
72 requires: Vec::new(),
73 provides: Vec::new(),
74 contract: OwnedObjectContract {
75 required_parts: Vec::new(),
76 provided_parts: Vec::new(),
77 },
78 flow: OwnedFlowContract::none(),
79 flow_provider: None,
80 handle_traits: Vec::new(),
81 part_traits: Vec::new(),
82 runtime_checks: Vec::new(),
83 plugin: None,
84 source: OwnedSourceLocation {
85 file: format!("scale/{index}.rs"),
86 line: 1,
87 column: 1,
88 function: kind,
89 },
90 }
91}Sourcepub fn is_declared(&self) -> bool
pub fn is_declared(&self) -> bool
Whether this owned contract carries a slot id. 本 owned 合同是否带有插槽 id。
Sourcepub fn semantically_compatible_with(&self, expected: &OwnedFlowContract) -> bool
pub fn semantically_compatible_with(&self, expected: &OwnedFlowContract) -> bool
Whether the two owned contracts agree literally or after known domains compare. 两份 owned 合同是字面一致,还是在已知语义域比较后相容。
Trait Implementations§
Source§impl Clone for OwnedFlowContract
impl Clone for OwnedFlowContract
Source§fn clone(&self) -> OwnedFlowContract
fn clone(&self) -> OwnedFlowContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more