pub struct RegistrationRule {
pub required_preset: Option<&'static str>,
pub required_parts: &'static [&'static str],
pub required_exports: &'static [&'static str],
pub required_handle_traits: &'static [&'static str],
pub required_part_traits: &'static [&'static str],
}Expand description
Structural rule for faces entering a Registry. 注册面进入 Registry 时必须满足的结构规范。
Fields§
§required_preset: Option<&'static str>Preset name every admitted face must declare; None leaves it unconstrained.
每个被接纳的注册面都必须声明的 preset 名;None 表示不作要求。
required_parts: &'static [&'static str]Part names every admitted face must provide. 每个被接纳的注册面都必须提供的 part 名称。
required_exports: &'static [&'static str]Export names every admitted face must declare. 每个被接纳的注册面都必须声明的导出名称。
required_handle_traits: &'static [&'static str]Interfaces the handle type must implement, for example ControlHandle.
handle 类型必须实现的接口,例如 ControlHandle。
required_part_traits: &'static [&'static str]Interfaces the parts type must implement, for example ActionParts.
parts 类型必须实现的接口,例如 ActionParts。
Implementations§
Source§impl RegistrationRule
impl RegistrationRule
Sourcepub const ANY: RegistrationRule
pub const ANY: RegistrationRule
Rule with no structural requirements; it admits any face. 不含任何结构要求的规则,接纳任意注册面。
Sourcepub const fn new() -> RegistrationRule
pub const fn new() -> RegistrationRule
Start an unconstrained structural rule. 创建一个尚未添加结构要求的规则。
Sourcepub const fn require_preset(self, preset: &'static str) -> RegistrationRule
pub const fn require_preset(self, preset: &'static str) -> RegistrationRule
Set the required preset name and return the updated rule. 设置所需 preset 名并返回更新后的规则。
Sourcepub const fn require_parts(
self,
parts: &'static [&'static str],
) -> RegistrationRule
pub const fn require_parts( self, parts: &'static [&'static str], ) -> RegistrationRule
Set the required part names and return the updated rule. 设置所需 part 名称并返回更新后的规则。
Sourcepub const fn require_exports(
self,
exports: &'static [&'static str],
) -> RegistrationRule
pub const fn require_exports( self, exports: &'static [&'static str], ) -> RegistrationRule
Set the required export names and return the updated rule. 设置所需导出名称并返回更新后的规则。
Sourcepub const fn require_handle_traits(
self,
traits: &'static [&'static str],
) -> RegistrationRule
pub const fn require_handle_traits( self, traits: &'static [&'static str], ) -> RegistrationRule
Set the required handle trait names and return the updated rule. 设置所需 handle trait 名称并返回更新后的规则。
Sourcepub const fn require_part_traits(
self,
traits: &'static [&'static str],
) -> RegistrationRule
pub const fn require_part_traits( self, traits: &'static [&'static str], ) -> RegistrationRule
Set the required parts trait names and return the updated rule. 设置所需 parts trait 名称并返回更新后的规则。
Sourcepub fn validate(&self, info: &RegistrationInfo) -> Vec<String>
pub fn validate(&self, info: &RegistrationInfo) -> Vec<String>
Return one message per unmet structural requirement for info; an empty
result means the declaration may enter the registry.
针对 info 的每项未满足结构要求各返回一条消息;结果为空表示该声明可进入注册机。
Sourcepub fn into_owned(self) -> OwnedRegistrationRule
pub fn into_owned(self) -> OwnedRegistrationRule
Copy this rule into the owned form a snapshot can retain. 将该规则复制为快照可长期持有的拥有所有权形式。
Trait Implementations§
Source§impl Clone for RegistrationRule
impl Clone for RegistrationRule
Source§fn clone(&self) -> RegistrationRule
fn clone(&self) -> RegistrationRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more