Backend

Trait Backend 

Source
pub trait Backend: Sized {
    // Required methods
    fn read<T: IndexRange>(&self, range: T) -> Result<&[u8]>;
    fn len(&self) -> usize;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn locate_start_offset(&self) -> Result<usize> { ... }
    fn locate_xref_offset(&self) -> Result<usize> { ... }
    fn read_xref_table_and_trailer(
        &self,
        start_offset: usize,
        resolve: &impl Resolve,
    ) -> Result<(XRefTable, Dictionary)> { ... }
}

Required Methods§

Source

fn read<T: IndexRange>(&self, range: T) -> Result<&[u8]>

Source

fn len(&self) -> usize

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn locate_start_offset(&self) -> Result<usize>

Returns the offset of the beginning of the file, i.e., where the %PDF-1.5 header is. (currently only used internally!)

Source

fn locate_xref_offset(&self) -> Result<usize>

Returns the value of startxref (currently only used internally!)

Source

fn read_xref_table_and_trailer( &self, start_offset: usize, resolve: &impl Resolve, ) -> Result<(XRefTable, Dictionary)>

Used internally by File, but could also be useful for applications that want to look at the raw PDF objects.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Backend for T
where T: Deref<Target = [u8]>,