pub trait RustConstructorResource:
Debug
+ Send
+ Sync {
// 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资源提供了一个公共接口,允许获取具体资源及其细节并对其进行修改。
§Thread Safety
This trait is automatically impl’d for types that implement Send and Sync,
allowing App to be used in multi-threaded contexts (e.g., Bevy).
§线程安全
此特征自动为实现了 Send 和 Sync 的类型 impl,使 App 可以在多线程上下文中使用(例如 Bevy)。
Required Methods§
Sourcefn as_any(&self) -> &dyn Any
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.
当实际类型已知时,允许向下转换到具体类型。
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
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.
当实际类型已知时,允许向下可变转换到具体类型。
Sourcefn display_display_info(&self) -> Option<DisplayInfo>
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。
Sourcefn modify_display_info(&mut self, display_info: DisplayInfo)
fn modify_display_info(&mut self, display_info: DisplayInfo)
Updates the display info field for this resource.
更新此资源的显示信息字段。
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])的形式存储,可用于分类、过滤或元数据存储。