#[non_exhaustive]pub struct ConvertCatalogOptions<'a> {
pub content: &'a str,
pub locale: Option<&'a str>,
pub source_locale: &'a str,
pub source_mode: CatalogMode,
pub target_mode: CatalogMode,
pub order_by: OrderBy,
pub po_serialize: SerializeOptions,
}catalog only.Expand description
Options for converting one in-memory catalog between explicit catalog modes.
The source and target modes are deliberately separate: a mode determines both storage format and semantic interpretation, so callers cannot accidentally ask one format to parse content from another. Conversion preserves the shared message-level PO/FCL model; format-specific PO headers and file-level comments are normalized when the target is FCL.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: &'a strSource catalog content.
locale: Option<&'a str>Optional expected catalog locale.
When the source declares a locale, it must match this value. When the source has no locale, this value is used for the target.
source_locale: &'a strSource locale used for source-side semantics and FCL header validation.
source_mode: CatalogModeMode used to parse the source content.
target_mode: CatalogModeMode used to render the target content.
order_by: OrderBySort order for canonical PO output.
FCL always uses its canonical collated (id, ctxt) order.
po_serialize: SerializeOptionsPO serializer controls for target PO output, e.g. width folding.
FCL output has a canonical line shape and ignores these controls.
Implementations§
Source§impl<'a> ConvertCatalogOptions<'a>
impl<'a> ConvertCatalogOptions<'a>
Sourcepub fn new(
content: &'a str,
source_locale: &'a str,
source_mode: CatalogMode,
target_mode: CatalogMode,
) -> ConvertCatalogOptions<'a>
pub fn new( content: &'a str, source_locale: &'a str, source_mode: CatalogMode, target_mode: CatalogMode, ) -> ConvertCatalogOptions<'a>
Creates in-memory conversion options with explicit source and target modes.
Optional fields default to an inferred locale, msgid ordering, and
default PO serialization.
Sourcepub fn with_locale(self, locale: &'a str) -> ConvertCatalogOptions<'a>
pub fn with_locale(self, locale: &'a str) -> ConvertCatalogOptions<'a>
Returns options that expect or supply the given catalog locale.
Sourcepub fn with_source_mode(
self,
source_mode: CatalogMode,
) -> ConvertCatalogOptions<'a>
pub fn with_source_mode( self, source_mode: CatalogMode, ) -> ConvertCatalogOptions<'a>
Returns options that parse with the given source mode.
Sourcepub fn with_target_mode(
self,
target_mode: CatalogMode,
) -> ConvertCatalogOptions<'a>
pub fn with_target_mode( self, target_mode: CatalogMode, ) -> ConvertCatalogOptions<'a>
Returns options that render with the given target mode.
Sourcepub fn with_order_by(self, order_by: OrderBy) -> ConvertCatalogOptions<'a>
pub fn with_order_by(self, order_by: OrderBy) -> ConvertCatalogOptions<'a>
Returns options that render PO output with the given sort order.
Sourcepub fn with_po_serialize_options(
self,
po_serialize: SerializeOptions,
) -> ConvertCatalogOptions<'a>
pub fn with_po_serialize_options( self, po_serialize: SerializeOptions, ) -> ConvertCatalogOptions<'a>
Returns options that render PO output with the given serializer controls.
Trait Implementations§
Source§impl<'a> Clone for ConvertCatalogOptions<'a>
impl<'a> Clone for ConvertCatalogOptions<'a>
Source§fn clone(&self) -> ConvertCatalogOptions<'a>
fn clone(&self) -> ConvertCatalogOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more