pub struct Config {
pub package: PackageInfo,
pub exports: Vec<ProtoFile>,
pub dependencies: Vec<Dependency>,
pub signaling_url: Url,
pub realm: Realm,
pub visible_in_discovery: bool,
pub acl: Option<Acl>,
pub mailbox_path: Option<PathBuf>,
pub tags: Vec<String>,
pub scripts: HashMap<String, String>,
pub webrtc: WebRtcConfig,
pub observability: ObservabilityConfig,
}Expand description
最终配置(已处理继承、默认值、验证、类型转换) 注意:没有 edition 字段,edition 只作用于解析阶段
Fields§
§package: PackageInfo包信息
exports: Vec<ProtoFile>导出的 proto 文件(已读取内容)
dependencies: Vec<Dependency>服务依赖(已展开)
signaling_url: Url信令服务器 URL(已验证)
realm: Realm所属 Realm (Security Realm)
visible_in_discovery: bool是否在服务发现中可见
acl: Option<Acl>访问控制列表
mailbox_path: Option<PathBuf>Mailbox 数据库路径
Some(path): 使用持久化 SQLite 数据库None: 使用内存模式 (:memory:)
Service tags (e.g., “latest”, “stable”, “v1.0”)
scripts: HashMap<String, String>脚本命令
webrtc: WebRtcConfigWebRTC 配置
observability: ObservabilityConfigObservability configuration (logging + tracing)
Implementations§
Source§impl Config
impl Config
Sourcepub fn proto_paths(&self) -> Vec<&PathBuf>
pub fn proto_paths(&self) -> Vec<&PathBuf>
获取所有 proto 文件路径
Sourcepub fn proto_contents(&self) -> Vec<&str>
pub fn proto_contents(&self) -> Vec<&str>
获取所有 proto 内容(用于计算服务指纹)
Sourcepub fn get_dependency(&self, alias: &str) -> Option<&Dependency>
pub fn get_dependency(&self, alias: &str) -> Option<&Dependency>
根据别名查找依赖
Sourcepub fn find_dependencies_by_type(
&self,
actr_type: &ActrType,
) -> Vec<&Dependency>
pub fn find_dependencies_by_type( &self, actr_type: &ActrType, ) -> Vec<&Dependency>
根据 ActrType 查找所有匹配的依赖
Sourcepub fn cross_realm_dependencies(&self) -> Vec<&Dependency>
pub fn cross_realm_dependencies(&self) -> Vec<&Dependency>
获取所有跨 Realm 的依赖
Sourcepub fn get_script(&self, name: &str) -> Option<&str>
pub fn get_script(&self, name: &str) -> Option<&str>
获取脚本命令
Sourcepub fn list_scripts(&self) -> Vec<&str>
pub fn list_scripts(&self) -> Vec<&str>
列出所有脚本名称
Sourcepub fn calculate_service_spec(&self) -> Option<ServiceSpec>
pub fn calculate_service_spec(&self) -> Option<ServiceSpec>
Calculate ServiceSpec from config
Returns None if no proto files are exported
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more