Struct i18n_config::Crate [−][src]
pub struct Crate<'a> { pub name: String, pub version: String, pub path: PathBuf, pub parent: Option<&'a Crate<'a>>, pub config_file_path: PathBuf, pub i18n_config: Option<I18nConfig>, }
Represents a rust crate.
Fields
name: String
The name of the crate.
version: String
The version of the crate.
path: PathBuf
The path to the crate.
parent: Option<&'a Crate<'a>>
Path to the parent crate which is triggering the localization for this crate.
config_file_path: PathBuf
The file path expected to be used for i18n_config
relative to this crate’s root.
i18n_config: Option<I18nConfig>
The localization config for this crate (if it exists).
Implementations
impl<'a> Crate<'a>
[src]
impl<'a> Crate<'a>
[src]pub fn from<P1: Into<PathBuf>, P2: Into<PathBuf>>(
path: P1,
parent: Option<&'a Crate<'_>>,
config_file_path: P2
) -> Result<Crate<'a>, I18nConfigError>
[src]
path: P1,
parent: Option<&'a Crate<'_>>,
config_file_path: P2
) -> Result<Crate<'a>, I18nConfigError>
Read crate from Cargo.toml
i18n config using the
config_file_path
(if there is one).
pub fn module_name(&self) -> String
[src]
The name of the module/library used for this crate. Replaces
-
characters with _
in the crate name.
pub fn parent_active_config(
&'a self
) -> Result<Option<(&'a Crate<'_>, &'a I18nConfig)>, I18nConfigError>
[src]
&'a self
) -> Result<Option<(&'a Crate<'_>, &'a I18nConfig)>, I18nConfigError>
If there is a parent, get it’s I18nConfig#active_config(), otherwise return None.
pub fn active_config(
&'a self
) -> Result<Option<(&'a Crate<'_>, &'a I18nConfig)>, I18nConfigError>
[src]
&'a self
) -> Result<Option<(&'a Crate<'_>, &'a I18nConfig)>, I18nConfigError>
Identify the config which should be used for this crate, and the crate (either this crate or one of it’s parents) associated with that config.
pub fn config_or_err(&self) -> Result<&I18nConfig, I18nConfigError>
[src]
Get the I18nConfig in this crate, or return an error if there is none present.
pub fn gettext_config_or_err(&self) -> Result<&GettextConfig, I18nConfigError>
[src]
Get the GettextConfig in this crate, or return an error if there is none present.
pub fn collated_subcrate(&self) -> bool
[src]
If this crate has a parent, check whether the parent wants to collate subcrates string extraction, as per the parent’s GettextConfig#collate_extracted_subcrates. This also requires that the current crate’s GettextConfig#extract_to_parent is true.
Returns false if there is no parent or the parent has no gettext config.
pub fn find_parent(&self) -> Option<Crate<'a>>
[src]
Attempt to resolve the parents of this crate which have this crate listed as a subcrate in their i18n config.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Crate<'a>
impl<'a> RefUnwindSafe for Crate<'a>
impl<'a> UnwindSafe for Crate<'a>
impl<'a> UnwindSafe for Crate<'a>