Skip to main content

PdfObjectTrait

Trait PdfObjectTrait 

Source
pub trait PdfObjectTrait: Display {
    // Required methods
    fn size_in_bytes(&self) -> usize;
    fn copy_bytes_into(&self, buffer: &mut [u8], offset: usize) -> usize;

    // Provided method
    fn to_bytes(&self) -> Vec<u8>  { ... }
}
Expand description

Trait implemented by all PDF object types. Provides serialization to PDF byte format.

Required Methods§

Source

fn size_in_bytes(&self) -> usize

Return the size in bytes when serialized.

Source

fn copy_bytes_into(&self, buffer: &mut [u8], offset: usize) -> usize

Copy serialized bytes into the buffer at the given offset. Returns the number of bytes written.

Provided Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Serialize to a Vec.

Implementors§