Skip to main content

RustConstructorResource

Trait RustConstructorResource 

Source
pub trait RustConstructorResource: Debug {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn display_display_info(&self) -> Option<DisplayInfo>;
    fn modify_display_info(&mut self, display_info: DisplayInfo);
    fn display_tags(&self) -> Vec<[String; 2]>;
    fn modify_tags(&mut self, tags: &[[String; 2]], replace: bool);
}
Expand description

Core trait for managing Rust Constructor resources uniformly.

统一管理Rust Constructor资源的核心特性。

This trait provides a common interface for all GUI resources in the framework, allowing for the acquisition and modification of specific resources and their details.

此特征为框架中的所有GUI资源提供了一个公共接口,允许获取具体资源及其细节并对其进行修改。

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Returns a reference to the resource as Any for extract the specific type.

Any返回对资源的引用,用于取出具体类型。

This allows downcasting to the concrete type when the actual type is known.

当实际类型已知时,允许向下转换到具体类型。

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Returns a mutable reference to the resource as Any for extract the specific type.

Any返回对资源的可变引用,用于取出具体类型。

This allows mutable downcasting when the actual type is known.

当实际类型已知时,允许向下可变转换到具体类型。

Source

fn display_display_info(&self) -> Option<DisplayInfo>

Retrieves the display info field for this resource.

取出此资源的显示信息字段。

Returns Some(DisplayInfo) if the resource has display info field, or None if it doesn’t have display info field.

如果资源具有显示信息字段则返回Some(DisplayInfo),如果资源没有显示信息字段则返回None

Source

fn modify_display_info(&mut self, display_info: DisplayInfo)

Updates the display info field for this resource.

更新此资源的显示信息字段。

Source

fn display_tags(&self) -> Vec<[String; 2]>

Returns all tags associated with this resource.

返回与此资源关联的所有标签。

Tags are stored as key-value pairs ([String; 2]) and can be used for categorization, filtering, or metadata storage.

标签以键值对([String; 2])的形式存储,可用于分类、过滤或元数据存储。

Source

fn modify_tags(&mut self, tags: &[[String; 2]], replace: bool)

Updates the tags for this resource.

更新此资源的标签。

§Arguments
  • replace - If true, replaces all existing tags; if false, merges with existing tags.
§参数
  • replace - 若为true,则替换所有现有的标签; 若为false,则与现有标签合并。

Implementors§