Skip to main content

ObjectContract

Struct ObjectContract 

Source
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

Source

pub fn into_owned(self) -> OwnedObjectContract

Copy this borrowed contract into the owned form a snapshot can retain. 将该借用合同复制为快照可长期持有的拥有所有权形式。

Source

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

Source§

fn clone(&self) -> ObjectContract

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 ObjectContract

Source§

impl Debug for ObjectContract

Source§

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

Formats the value using the given formatter. Read more

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.