pub struct ObjectContract {
pub required_parts: &'static [&'static str],
pub provided_parts: &'static [&'static str],
}Expand description
Runtime-readable form of the construction contract. 构造合同的运行时可读形式。
Fields§
§required_parts: &'static [&'static str]Part names the preset declared it needs. preset 声明它需要的 part 名称。
provided_parts: &'static [&'static str]Part names the parts type supplied. parts 类型实际提供的 part 名称。
Implementations§
Source§impl ObjectContract
impl ObjectContract
Sourcepub fn into_owned(self) -> OwnedObjectContract
pub fn into_owned(self) -> OwnedObjectContract
Copy this borrowed contract into the owned form a snapshot can retain. 将该借用合同复制为快照可长期持有的拥有所有权形式。
Sourcepub fn validate(&self, object: &str) -> Vec<String>
pub fn validate(&self, object: &str) -> Vec<String>
Return one message per unmet part requirement; an empty result means the
contract holds. object names the face being checked.
每个未满足的 part 要求各返回一条消息;结果为空表示合同成立。
object 是被检查的注册面名称。
The output half of this check is gone with the two names it compared: a
type-level assert_contract proves the same fact at compile time, per
face, and a graft cut proves it across two faces. This method now reports
only what the trait constants say, which is the part no compiler can see.
本检查的输出那一半随它比较的那两个名字一起删除:同一件事由编译期
assert_contract 按面证明、由嫁接切口跨两个面证明。本方法现在只报告 trait 常量
说了算的东西——那是编译器看不到的部分。
Trait Implementations§
Source§impl Clone for ObjectContract
impl Clone for ObjectContract
Source§fn clone(&self) -> ObjectContract
fn clone(&self) -> ObjectContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more