#[non_exhaustive]pub enum Meta {
Connect,
Disconnect {
reason: Option<String>,
},
Ready {
self_id: Uin,
nickname: String,
},
Heartbeat {
interval: i64,
status: ImplStatus,
},
BotOnline {
reason: Option<String>,
},
BotOffline,
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Connect
协议端(传输层)连上:由框架的事件源在底层 socket 连接成功时发出(正向/反向 WS、 Milky WS 等),跨协议口径一致;每次(重)连都发一次。是「协议端连接」的权威信号。
Disconnect
协议端(传输层)断开:由框架的事件源在 socket 掉线、即将重连前发出。reason
为底层错误文案(如有)。正常停机不发。注意:传输断开 ≠ 账号掉线(见 Meta::BotOffline)。
Ready
框架就绪:登录已解析出可用账号(self_id != 0)、Bot 句柄可正常动作。每次
run_* 仅发一次(重连不重放)。需要「机器人完全就绪且有可用账号」才跑的逻辑
(定时任务 / 加载后初始化)监听此事件即可:无可用账号则它根本不发、相关逻辑自然不跑。
nickname 为登录账号的昵称(来自 get_login_info;未知时为空串)。
Heartbeat
BotOnline
机器人上线(Lagrange bot_online / OneBot lifecycle enable)。reason 为
Lagrange 上线原因文案(如重连/扫码);无该信息的来源为 None。
BotOffline
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Meta
impl RefUnwindSafe for Meta
impl Send for Meta
impl Sync for Meta
impl Unpin for Meta
impl UnsafeUnpin for Meta
impl UnwindSafe for Meta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more