pub struct SchemaProvider { /* private fields */ }Expand description
Schema 提供者
管理配置 Schema,提供配置项元数据查询
Implementations§
Source§impl SchemaProvider
impl SchemaProvider
Sourcepub async fn load_with_workspace(workspace_path: &Path) -> Result<Self>
pub async fn load_with_workspace(workspace_path: &Path) -> Result<Self>
Sourcepub fn has_plugin(&self, prefix: &str) -> bool
pub fn has_plugin(&self, prefix: &str) -> bool
获取插件 Schema
检查指定的配置前缀是否在 Schema 中定义
Sourcepub fn get_all_prefixes(&self) -> Vec<String>
pub fn get_all_prefixes(&self) -> Vec<String>
获取所有配置前缀
返回所有已注册插件的配置前缀列表
Sourcepub fn get_plugin_schema(&self, prefix: &str) -> Option<&Value>
pub fn get_plugin_schema(&self, prefix: &str) -> Option<&Value>
获取插件的 Schema
返回指定插件的 JSON Schema
Sourcepub fn has_property(&self, prefix: &str, property: &str) -> bool
pub fn has_property(&self, prefix: &str, property: &str) -> bool
检查配置属性是否存在
查询指定插件的指定属性是否在 Schema 中定义
Sourcepub fn get_plugin(&self, prefix: &str) -> Option<PluginSchema>
pub fn get_plugin(&self, prefix: &str) -> Option<PluginSchema>
获取插件的结构化 Schema
将 JSON Schema 解析为 PluginSchema 结构
Source§impl SchemaProvider
impl SchemaProvider
Sourcepub fn from_schema(schema: ConfigSchema) -> Self
pub fn from_schema(schema: ConfigSchema) -> Self
从给定的 ConfigSchema 创建 SchemaProvider(用于测试)
这个方法主要用于属性测试,允许使用自定义的 Schema 创建提供者
Trait Implementations§
Source§impl Clone for SchemaProvider
impl Clone for SchemaProvider
Source§fn clone(&self) -> SchemaProvider
fn clone(&self) -> SchemaProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SchemaProvider
impl RefUnwindSafe for SchemaProvider
impl Send for SchemaProvider
impl Sync for SchemaProvider
impl Unpin for SchemaProvider
impl UnsafeUnpin for SchemaProvider
impl UnwindSafe for SchemaProvider
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