pub struct LocaUtils;Expand description
Utility functions for loading and saving localization files.
Implementations§
Source§impl LocaUtils
impl LocaUtils
Sourcepub fn load(path: impl AsRef<Path>) -> Result<LocaResource>
pub fn load(path: impl AsRef<Path>) -> Result<LocaResource>
Loads a localization resource from a file, detecting format from extension.
Sourcepub fn load_with_format(
path: impl AsRef<Path>,
format: LocaFormat,
) -> Result<LocaResource>
pub fn load_with_format( path: impl AsRef<Path>, format: LocaFormat, ) -> Result<LocaResource>
Loads a localization resource from a file with explicit format.
Sourcepub fn load_from_reader<R: Read>(
reader: R,
format: LocaFormat,
) -> Result<LocaResource>
pub fn load_from_reader<R: Read>( reader: R, format: LocaFormat, ) -> Result<LocaResource>
Loads a localization resource from a reader.
Sourcepub fn load_from_bytes(data: &[u8], format: LocaFormat) -> Result<LocaResource>
pub fn load_from_bytes(data: &[u8], format: LocaFormat) -> Result<LocaResource>
Loads a localization resource from bytes.
Sourcepub fn save(resource: &LocaResource, path: impl AsRef<Path>) -> Result<()>
pub fn save(resource: &LocaResource, path: impl AsRef<Path>) -> Result<()>
Saves a localization resource to a file, detecting format from extension.
Sourcepub fn save_with_format(
resource: &LocaResource,
path: impl AsRef<Path>,
format: LocaFormat,
) -> Result<()>
pub fn save_with_format( resource: &LocaResource, path: impl AsRef<Path>, format: LocaFormat, ) -> Result<()>
Saves a localization resource to a file with explicit format.
Sourcepub fn save_to_writer<W: Write>(
resource: &LocaResource,
writer: W,
format: LocaFormat,
) -> Result<()>
pub fn save_to_writer<W: Write>( resource: &LocaResource, writer: W, format: LocaFormat, ) -> Result<()>
Saves a localization resource to a writer.
Sourcepub fn save_to_bytes(
resource: &LocaResource,
format: LocaFormat,
) -> Result<Vec<u8>>
pub fn save_to_bytes( resource: &LocaResource, format: LocaFormat, ) -> Result<Vec<u8>>
Saves a localization resource to bytes.
Auto Trait Implementations§
impl Freeze for LocaUtils
impl RefUnwindSafe for LocaUtils
impl Send for LocaUtils
impl Sync for LocaUtils
impl Unpin for LocaUtils
impl UnwindSafe for LocaUtils
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