Struct sarc_rs::SarcWriter
source · [−]Expand description
A simple SARC archive writer
Fields
files: IndexMap<String, Vec<u8>>
Files to be written.
Implementations
sourceimpl SarcWriter
impl SarcWriter
sourcepub fn new(endian: Endian) -> SarcWriter
pub fn new(endian: Endian) -> SarcWriter
A simple SARC archive writer
sourcepub fn from_sarc(sarc: &Sarc<'_>) -> SarcWriter
pub fn from_sarc(sarc: &Sarc<'_>) -> SarcWriter
Creates a new SARC writer by taking attributes and files from an existing SARC reader
sourcepub fn write_to_bytes(&mut self) -> Result<Vec<u8>, SarcWriteError>
pub fn write_to_bytes(&mut self) -> Result<Vec<u8>, SarcWriteError>
Write a SARC archive to an in-memory buffer using the specified endianness. Default alignment requirements may be automatically added.
sourcepub fn write<W: Write + Seek>(
&mut self,
writer: &mut W
) -> Result<(), SarcWriteError>
pub fn write<W: Write + Seek>(
&mut self,
writer: &mut W
) -> Result<(), SarcWriteError>
Write a SARC archive to a Write + Seek writer using the specified endianness. Default alignment requirements may be automatically added.
sourcepub fn add_alignment_requirement(
&mut self,
ext: String,
alignment: usize
) -> Result<(), SarcWriteError>
pub fn add_alignment_requirement(
&mut self,
ext: String,
alignment: usize
) -> Result<(), SarcWriteError>
Add or modify a data alignment requirement for a file type. Set the alignment to 1 to revert.
Arguments
ext
- File extension without the dot (e.g. “bgparamlist”)alignment
- Data alignment (must be a power of 2)
sourcepub fn set_min_alignment(
&mut self,
alignment: usize
) -> Result<(), SarcWriteError>
pub fn set_min_alignment(
&mut self,
alignment: usize
) -> Result<(), SarcWriteError>
Set the minimum data alignment
sourcepub fn set_legacy_mode(&mut self, value: bool)
pub fn set_legacy_mode(&mut self, value: bool)
Set whether to use legacy mode (for games without a BOTW-style resource system) for addtional alignment restrictions
sourcepub fn set_endian(&mut self, endian: Endian)
pub fn set_endian(&mut self, endian: Endian)
Set the endianness
sourcepub fn is_file_sarc(data: &[u8]) -> bool
pub fn is_file_sarc(data: &[u8]) -> bool
Checks if a data slice represents a SARC archive
Trait Implementations
sourceimpl Clone for SarcWriter
impl Clone for SarcWriter
sourcefn clone(&self) -> SarcWriter
fn clone(&self) -> SarcWriter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SarcWriter
impl Debug for SarcWriter
sourceimpl PartialEq<SarcWriter> for SarcWriter
impl PartialEq<SarcWriter> for SarcWriter
sourcefn eq(&self, other: &SarcWriter) -> bool
fn eq(&self, other: &SarcWriter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SarcWriter) -> bool
fn ne(&self, other: &SarcWriter) -> bool
This method tests for !=
.
impl Eq for SarcWriter
impl StructuralEq for SarcWriter
impl StructuralPartialEq for SarcWriter
Auto Trait Implementations
impl RefUnwindSafe for SarcWriter
impl Send for SarcWriter
impl Sync for SarcWriter
impl Unpin for SarcWriter
impl UnwindSafe for SarcWriter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.