Writer

Struct Writer 

Source
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,

Source

pub fn new(write: T) -> Writer<T>

Create a new TPK writer.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<T> Freeze for Writer<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Writer<T>
where T: RefUnwindSafe,

§

impl<T> Send for Writer<T>
where T: Send,

§

impl<T> Sync for Writer<T>
where T: Sync,

§

impl<T> Unpin for Writer<T>
where T: Unpin,

§

impl<T> UnwindSafe for Writer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.