| Crates.io | moduforge-runtime |
| lib.rs | moduforge-runtime |
| version | 0.2.4 |
| created_at | 2025-03-18 12:38:48.953806+00 |
| updated_at | 2025-04-07 11:11:54.581745+00 |
| description | 插件加载、热更新、依赖管理 |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1596550 |
| size | 109,054 |
ModuForge Runtime 是一个强大的 Rust 编辑器运行时框架,提供了插件加载、热更新、依赖管理等核心功能。该框架设计用于构建可扩展的编辑器系统,支持异步操作和事件驱动架构。
插件系统
异步运行时
状态管理
事件系统
扩展性
ModuForge Runtime 提供了两种运行时实现,以满足不同的使用场景:
同步运行时实现,适用于:
特点:
异步运行时实现,适用于:
特点:
| 特性 | Runtime | AsyncRuntime |
|---|---|---|
| 并发处理 | 基础 | 高级 |
| 性能 | 一般 | 优秀 |
| 复杂度 | 低 | 高 |
| 适用场景 | 简单应用 | 复杂应用 |
| 资源消耗 | 较低 | 较高 |
| 开发难度 | 简单 | 较复杂 |
编辑器核心实现,负责:
扩展管理器,处理:
历史记录管理器,提供:
事件总线,实现:
主要依赖包括:
use moduforge_runtime::{
Editor,
EditorOptions,
EditorResult,
};
fn main() -> EditorResult<()> {
// 创建编辑器配置
let options = EditorOptions::new()
.with_extensions(vec![])
.with_content("初始内容");
// 创建编辑器实例
let mut editor = Editor::create(options)?;
// 初始化编辑器
editor.init()?;
// 使用编辑器...
Ok(())
}
use moduforge_runtime::{
Editor,
EditorOptions,
EditorResult,
};
#[tokio::main]
async fn main() -> EditorResult<()> {
// 创建编辑器配置
let options = EditorOptions::new()
.with_extensions(vec![])
.with_content("初始内容");
// 创建异步编辑器实例
let mut editor = Editor::create(options).await?;
// 初始化编辑器
editor.init().await?;
// 使用异步编辑器...
Ok(())
}
src/
├── async_processor.rs // 异步处理器实现
├── async_runtime.rs // 异步运行时实现
├── error.rs // 错误处理
├── event.rs // 事件系统
├── extension.rs // 扩展接口
├── extension_manager.rs // 扩展管理器
├── flow.rs // 流程控制
├── history_manager.rs // 历史记录管理
├── macros.rs // 宏定义
├── node.rs // 节点实现
├── runtime.rs // 运行时核心
├── traits.rs // 特征定义
└── types.rs // 类型定义
cargo testcargo build欢迎提交 Pull Request 和 Issue。在提交代码前,请确保:
本项目采用 MIT 许可证