[−][src]Struct i18n_config::Crate
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).
Methods
impl<'a> Crate<'a>
[src]
pub fn from<P: Into<PathBuf>>(
path: P,
parent: Option<&'a Crate>,
config_file_path: P
) -> Result<Crate<'a>>
[src]
path: P,
parent: Option<&'a Crate>,
config_file_path: P
) -> Result<Crate<'a>>
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) -> Option<(&'a Crate, &'a I18nConfig)>
[src]
If there is a parent, get it's I18nConfig#active_config(), otherwise return None.
pub fn active_config(&'a self) -> Option<(&'a Crate, &'a I18nConfig)>
[src]
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>
[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>
[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.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Crate<'a>
impl<'a> Send for Crate<'a>
impl<'a> Sync for Crate<'a>
impl<'a> Unpin for Crate<'a>
impl<'a> UnwindSafe for Crate<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,