Skip to main content

Xref

Struct Xref 

Source
pub struct Xref { /* private fields */ }
Expand description

Where every object in a document lives.

Ordered by object number, because reading it that way is what both the page walk and the writer want, and because the largest object number is a value the reader consults constantly. That order is an array index rather than a tree; the private EntryTable this wraps carries the why.

Implementations§

Source§

impl Xref

Source

pub fn sections(&self) -> &[Section]

The sections the load followed, oldest first — one per revision of an incrementally updated file. Empty when the table was rebuilt by scanning, since no chain was followed then.

Source

pub fn new() -> Self

An empty table.

Source

pub fn entry(&self, num: u32) -> Option<Entry>

Where object num lives, if the table says anything about it.

Source

pub fn generation(&self, num: u32) -> u16

The generation the table records for num.

Source

pub fn is_object_stream(&self, num: u32) -> bool

Whether some entry named num as the object stream it lives in.

Source

pub fn len(&self) -> usize

How many objects the table describes.

Source

pub fn is_empty(&self) -> bool

Whether the table describes nothing.

Source

pub fn object_numbers(&self) -> impl Iterator<Item = u32> + '_

Every object number the table describes, in ascending order.

Source

pub fn last_object_number(&self) -> u32

The largest object number the table describes.

Source

pub fn is_valid_object_number(&self, num: u32) -> bool

Whether num is a number this table could possibly describe.

Object numbers past the table’s largest are unfetchable even when the bytes for them sit in the file — the table is the only index the reader has, and PDFium refuses to look past its end.

Trait Implementations§

Source§

impl Clone for Xref

Source§

fn clone(&self) -> Xref

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Xref

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Xref

Source§

fn default() -> Xref

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Xref

§

impl RefUnwindSafe for Xref

§

impl Send for Xref

§

impl Sync for Xref

§

impl Unpin for Xref

§

impl UnsafeUnpin for Xref

§

impl UnwindSafe for Xref

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.