pub struct Writer<T> { /* private fields */ }Expand description
A TPK writer structure.
This structure holds the destination to which TPK data should be written.
Implementations§
Source§impl<T> Writer<T>where
T: Write,
impl<T> Writer<T>where
T: Write,
Sourcepub fn new(write: T) -> Writer<T>
pub fn new(write: T) -> Writer<T>
Create a new TPK writer.
Sourcepub fn write_element(&mut self, element: &Element) -> Result<()>
pub fn write_element(&mut self, element: &Element) -> Result<()>
Write the given Element to this writer.
This function will write the binary representation of the TPK element, including the type byte, size bytes and data bytes (if any).
Note that this is a low-level function and, as such, it makes it possible to write semantically invalid TPK data, especially while writing marker elements.
Sourcepub fn write_entry(&mut self, entry: &Entry) -> Result<()>
pub fn write_entry(&mut self, entry: &Entry) -> Result<()>
Write the given Entry to this writer.
This function will write the binary representation of this entry, by writing a marker element containing the name of the entry, as well as every data element that this entry contains.
Note that this is a low-level function, and as such, it is possible to write semantically invalid TPK data using this function if the entry contains an invalid name.