feat: 集成Rust WASM渲染引擎与TypeScript ECS框架 (#228)

* feat: 集成Rust WASM渲染引擎与TypeScript ECS框架

* feat: 增强编辑器UI功能与跨平台支持

* fix: 修复CI测试和类型检查问题

* fix: 修复CI问题并提高测试覆盖率

* fix: 修复CI问题并提高测试覆盖率
This commit is contained in:
YHH
2025-11-21 10:03:18 +08:00
committed by GitHub
parent 8b9616837d
commit a768b890fd
107 changed files with 10221 additions and 477 deletions

View File

@@ -0,0 +1,55 @@
//! Resource handle types.
//! 资源句柄类型。
/// Type alias for resource handle IDs.
/// 资源句柄ID的类型别名。
pub type HandleId = u32;
/// Generic resource handle.
/// 通用资源句柄。
///
/// A lightweight identifier for referencing loaded resources.
/// 用于引用已加载资源的轻量级标识符。
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Handle<T> {
/// Unique identifier.
/// 唯一标识符。
id: HandleId,
/// Phantom data for type safety.
/// 用于类型安全的幻象数据。
_marker: std::marker::PhantomData<T>,
}
impl<T> Handle<T> {
/// Create a new handle with the given ID.
/// 使用给定ID创建新句柄。
#[inline]
pub const fn new(id: HandleId) -> Self {
Self {
id,
_marker: std::marker::PhantomData,
}
}
/// Get the handle ID.
/// 获取句柄ID。
#[inline]
pub const fn id(&self) -> HandleId {
self.id
}
}
impl<T> From<HandleId> for Handle<T> {
#[inline]
fn from(id: HandleId) -> Self {
Self::new(id)
}
}
impl<T> From<Handle<T>> for HandleId {
#[inline]
fn from(handle: Handle<T>) -> Self {
handle.id
}
}

View File

@@ -0,0 +1,7 @@
//! Resource management system.
//! 资源管理系统。
mod handle;
pub use handle::{Handle, HandleId};
pub use crate::renderer::texture::{Texture, TextureManager};