pub struct ExtensionManagerBuilder { /* private fields */ }
Expand description
ExtensionManager构建器
提供灵活的方式来配置和创建ExtensionManager,支持多种扩展来源
Implementations§
Source§impl ExtensionManagerBuilder
impl ExtensionManagerBuilder
Sourcepub fn add_extension(self, extension: Extensions) -> Self
pub fn add_extension(self, extension: Extensions) -> Self
Sourcepub fn add_extensions(self, extensions: Vec<Extensions>) -> Self
pub fn add_extensions(self, extensions: Vec<Extensions>) -> Self
Sourcepub fn add_xml_file<P: AsRef<str>>(self, xml_file_path: P) -> Self
pub fn add_xml_file<P: AsRef<str>>(self, xml_file_path: P) -> Self
Sourcepub fn add_xml_files<P: AsRef<str>>(self, xml_file_paths: &[P]) -> Self
pub fn add_xml_files<P: AsRef<str>>(self, xml_file_paths: &[P]) -> Self
Sourcepub fn add_xml_content<S: AsRef<str>>(self, xml_content: S) -> Self
pub fn add_xml_content<S: AsRef<str>>(self, xml_content: S) -> Self
添加XML内容字符串
§参数
xml_content
- XML schema内容
§示例
use mf_core::ExtensionManagerBuilder;
let xml = r#"
<?xml version="1.0" encoding="UTF-8"?>
<schema>
<nodes>
<node name="custom">
<desc>自定义节点</desc>
</node>
</nodes>
</schema>
"#;
let manager = ExtensionManagerBuilder::new()
.add_xml_content(xml)
.build()?;
Sourcepub fn add_xml_contents<S: AsRef<str>>(self, xml_contents: &[S]) -> Self
pub fn add_xml_contents<S: AsRef<str>>(self, xml_contents: &[S]) -> Self
Sourcepub fn build(self) -> ForgeResult<ExtensionManager>
pub fn build(self) -> ForgeResult<ExtensionManager>
Trait Implementations§
Source§impl Default for ExtensionManagerBuilder
impl Default for ExtensionManagerBuilder
Source§fn default() -> ExtensionManagerBuilder
fn default() -> ExtensionManagerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ExtensionManagerBuilder
impl !RefUnwindSafe for ExtensionManagerBuilder
impl Send for ExtensionManagerBuilder
impl Sync for ExtensionManagerBuilder
impl Unpin for ExtensionManagerBuilder
impl !UnwindSafe for ExtensionManagerBuilder
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> 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