Skip to main content

OwnedFlowContract

Struct OwnedFlowContract 

Source
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: String

Target slot; the owned snapshot’s twin of FlowContract::id. 目标插槽;owned 快照中对应 FlowContract::id 的一侧。

§version: u32

Contract version; the owned twin of FlowContract::version. 合同版本;FlowContract::version 的 owned 孪生。

§input: String

Declared input label; the owned twin of FlowContract::input. 声明的输入标签;FlowContract::input 的 owned 孪生。

§output: String

Declared output label; the owned twin of FlowContract::output. 声明的输出标签;FlowContract::output 的 owned 孪生。

Implementations§

Source§

impl OwnedFlowContract

Source

pub fn none() -> OwnedFlowContract

The undeclared owned contract: empty strings and version zero. 未声明的 owned 合同:字符串为空、版本为 0。

Examples found in repository?
examples/scale_audit.rs (line 78)
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}
Source

pub fn is_declared(&self) -> bool

Whether this owned contract carries a slot id. 本 owned 合同是否带有插槽 id。

Source

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

Source§

fn clone(&self) -> OwnedFlowContract

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 Debug for OwnedFlowContract

Source§

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

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

impl Display for OwnedFlowContract

Source§

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

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

impl Eq for OwnedFlowContract

Source§

impl From<FlowContract> for OwnedFlowContract

Source§

fn from(contract: FlowContract) -> OwnedFlowContract

Converts to this type from the input type.
Source§

impl PartialEq for OwnedFlowContract

Source§

fn eq(&self, other: &OwnedFlowContract) -> 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 OwnedFlowContract

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.