Skip to main content

Element

Enum Element 

Source
pub enum Element {
    Header {
        version: (u8, u8),
        span: Span,
    },
    IndirectObject {
        r: ObjRef,
        object: Object,
        span: Span,
        in_objstm: Option<(ObjRef, Span)>,
    },
    XrefSection {
        kind: XrefKind,
        span: Span,
        entries: usize,
    },
    Trailer {
        dict: Dict,
        span: Span,
    },
    StartXref {
        offset: u64,
        span: Span,
    },
    Eof {
        span: Span,
    },
    Page {
        index: usize,
        r: ObjRef,
    },
    Font {
        page: Option<usize>,
        r: ObjRef,
        subtype: Name,
        base_font: Option<Name>,
    },
    Image {
        page: Option<usize>,
        r: ObjRef,
        width: u32,
        height: u32,
    },
    Annotation {
        page: usize,
        r: ObjRef,
        subtype: Name,
    },
    ContentOp {
        page: usize,
        op: Op,
        span_in_content: Span,
    },
}
Expand description

One element of a document, physical or logical.

Variants§

§

Header

The %PDF-x.y header.

Fields

§version: (u8, u8)
§span: Span
§

IndirectObject

One indirect object.

Fields

§object: Object
§span: Span

Span of N G obj … endobj in the file. For objects stored in an object stream this is the container stream object’s span.

§in_objstm: Option<(ObjRef, Span)>

For objects inside an object stream: the container’s reference and this object’s byte range within the decoded stream data.

§

XrefSection

One cross-reference section (table or stream).

Fields

§span: Span
§entries: usize
§

Trailer

The trailer: the merged trailer dictionary plus the byte range of the newest trailer region (classic trailer << … >>, or the newest cross-reference stream object when no classic trailer exists). The dict is the MERGED trailer dictionary (keys from newer sections win), while span covers only the newest trailer region — so unlike other physical elements, re-parsing the bytes at span does not reproduce dict.

Fields

§dict: Dict
§span: Span
§

StartXref

The startxref keyword and its offset operand.

Fields

§offset: u64
§span: Span
§

Eof

The %%EOF marker.

Fields

§span: Span
§

Page

One page (logical).

Fields

§index: usize
§

Font

One font referenced from a page’s resources.

Fields

§subtype: Name
§base_font: Option<Name>
§

Image

One image XObject referenced from a page’s resources.

Fields

§width: u32
§height: u32
§

Annotation

One annotation on a page.

Fields

§page: usize
§subtype: Name
§

ContentOp

One content-stream operator of a page.

Fields

§page: usize
§op: Op
§span_in_content: Span

Byte range within the page’s decoded, concatenated content.

Trait Implementations§

Source§

impl Clone for Element

Source§

fn clone(&self) -> Element

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 Element

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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 = 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.