docs: 添加 Rustdoc 注释

This commit is contained in:
爱特每羊队
2026-08-05 21:46:47 +08:00
parent bbdfca1a1c
commit f461235f04
158 changed files with 1440 additions and 15 deletions
+15
View File
@@ -1,3 +1,13 @@
//! 日志级别定义。
//!
//! [`Level`] 是引擎内部使用的日志级别枚举,与 `tracing` 的级别一一对应,
//! 通过 [`Level::as_tracing_level`] 转换。值以 `u8` 存储(`repr(u8)`),
//! 可直接写入 `SubsystemFilter` 的原子级别槽位。
/// 日志级别。
///
/// 由低到高:`Off` < `Error` < `Warn` < `Info` < `Debug` < `Trace`。
/// `Off` 表示完全关闭,仅由 `SubsystemFilter` 判读,不映射到 `tracing` 级别。
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Level {
@@ -10,6 +20,11 @@ pub enum Level {
}
impl Level {
/// 转换为 `tracing` 的 [`tracing::Level`]。
///
/// `Off` 与 `Error` 都映射到 `ERROR`——关闭语义由
/// [`SubsystemFilter`](crate::SubsystemFilter) 的 `Off` 分支单独处理,
/// 这里仅保证其余级别 1:1 对齐。
pub const fn as_tracing_level(self) -> tracing::Level {
match self {
Level::Off | Level::Error => tracing::Level::ERROR,