pub struct BuiltinConfig;Expand description
Built-in configuration file embedder/extractor.
Embeds the files under /examples/ into the binary.
Implementations§
Source§impl BuiltinConfig
impl BuiltinConfig
pub fn compressed(file_path: &str) -> Option<EmbeddedCompressedFile>
pub fn get(file_path: &str) -> Option<EmbeddedFile>
Source§impl BuiltinConfig
impl BuiltinConfig
Sourcepub fn get_config(name: String) -> Result<String>
pub fn get_config(name: String) -> Result<String>
Extracts the embedded content.
Sourcepub fn parse(name: String) -> Result<(Config, String)>
pub fn parse(name: String) -> Result<(Config, String)>
Parses the extracted content into Config along with the name.
Sourcepub fn validate_templates_dir(dir: &Path) -> Result<()>
pub fn validate_templates_dir(dir: &Path) -> Result<()>
Validates a user-defined templates directory.
Sourcepub fn get_config_from(
name: String,
templates_dir: Option<&Path>,
) -> Result<String>
pub fn get_config_from( name: String, templates_dir: Option<&Path>, ) -> Result<String>
Extracts the template content for name, preferring a user-provided
template found in templates_dir (if given) over the built-in template
of the same name. The .toml extension is optional in name.
Sourcepub fn list() -> Vec<String>
pub fn list() -> Vec<String>
Lists the names of the built-in templates, without the .toml
extension and in sorted order.
Sourcepub fn list_templates(templates_dir: Option<&Path>) -> Result<Vec<String>>
pub fn list_templates(templates_dir: Option<&Path>) -> Result<Vec<String>>
Lists the names of every available template — built-in templates plus
the .toml templates found in templates_dir (if given) — without the
.toml extension, sorted and deduplicated.
Returns an error if templates_dir is provided but cannot be read
(e.g. it does not exist or is not a directory).
Trait Implementations§
Source§impl RustEmbed for BuiltinConfig
impl RustEmbed for BuiltinConfig
Source§fn compressed(file_path: &str) -> Option<EmbeddedCompressedFile>
fn compressed(file_path: &str) -> Option<EmbeddedCompressedFile>
compression only.Auto Trait Implementations§
impl Freeze for BuiltinConfig
impl RefUnwindSafe for BuiltinConfig
impl Send for BuiltinConfig
impl Sync for BuiltinConfig
impl Unpin for BuiltinConfig
impl UnsafeUnpin for BuiltinConfig
impl UnwindSafe for BuiltinConfig
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
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> ⓘ
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> ⓘ
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