✨ feat(vscode): 代码阅读预览 Rust 的语言卡片
This commit is contained in:
1 parent
4480f936f3
commit
6d58b681cf
15 files changed
+1016
-6
No files matched your search
@@ -0,0 +1,45 @@
|
||||
use serde::Serialize;
|
||||
use std::sync::Arc;
|
||||
use foo::{Bar as Baz, Qux};
|
||||
|
||||
/// 桌面端列表里的一行代理。
|
||||
/// 后面还有一句。
|
||||
pub struct AgentRow {
|
||||
pub id: Uuid,
|
||||
name: String,
|
||||
}
|
||||
|
||||
pub(crate) struct CrateOnly {
|
||||
pub(super) up: u8,
|
||||
}
|
||||
|
||||
/// 这个代理现在处在哪一步。
|
||||
pub enum AgentState {
|
||||
Idle,
|
||||
Running { pid: u32 },
|
||||
Failed(String),
|
||||
}
|
||||
|
||||
impl AgentRow {
|
||||
fn rename(&mut self, name: String) {}
|
||||
}
|
||||
|
||||
/// 在本机拉起接口服务。
|
||||
pub async fn start_server(addr: SocketAddr) -> Result<(), StartError> {
|
||||
match result {
|
||||
Ok(listener) => {
|
||||
// 记下监听地址
|
||||
self.listener = Some(listener);
|
||||
}
|
||||
Err(err) => {
|
||||
// 返回 StartError
|
||||
return Err(StartError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 按 id 读写代理。
|
||||
pub trait Store {
|
||||
fn get(&self, id: Uuid) -> Result<AgentRow, StoreError>;
|
||||
fn save(&mut self, row: AgentRow) -> Result<(), StoreError>;
|
||||
}
|
||||
Reference in new issue
Block a user