Skip to main content

Obj

Enum Obj 

Source
pub enum Obj {
    Null,
    Bool(bool),
    Num(f64),
    Name(Vec<u8>),
    Str(Vec<u8>),
    Arr(Vec<Obj>),
    Dict(Vec<(Vec<u8>, Obj)>),
    Stream {
        dict: Vec<(Vec<u8>, Obj)>,
        data: Vec<u8>,
    },
    Ref(Ref),
}
Expand description

A parsed PDF object. Dict keeps file order: dictionary keys repeat legally and /Index-style array payloads rely on position, not sorting.

Variants§

§

Null

null

§

Bool(bool)

true / false

§

Num(f64)

A number. Integers and reals share one node; Obj::as_i64 refuses non-integral values.

§

Name(Vec<u8>)

A /Name without the leading slash, #xx escapes decoded.

§

Str(Vec<u8>)

A decoded string (literal or hex; escapes resolved).

§

Arr(Vec<Obj>)

[ … ]

§

Dict(Vec<(Vec<u8>, Obj)>)

<< … >>; keys are decoded names.

§

Stream

A dictionary followed by stream data. data is the raw stream content (filters NOT applied).

Fields

§dict: Vec<(Vec<u8>, Obj)>

The stream’s dictionary.

§data: Vec<u8>

Raw stream bytes.

§

Ref(Ref)

N G R

Implementations§

Source§

impl Obj

Source

pub fn get(&self, key: &[u8]) -> Option<&Obj>

Look up key in a Dict or Stream dictionary.

Source

pub fn dict(&self) -> Option<&[(Vec<u8>, Obj)]>

The dictionary part of a Dict or Stream.

Source

pub fn as_ref(&self) -> Option<Ref>

The reference if this is an indirect reference.

Source

pub fn as_f64(&self) -> Option<f64>

f64 for Num.

Source

pub fn as_i64(&self) -> Option<i64>

i64 for integer-valued Num.

Source

pub fn as_u32(&self) -> Option<u32>

u32 for non-negative integer-valued Num.

Source

pub fn as_usize(&self) -> Option<usize>

usize for non-negative integer-valued Num.

Source

pub fn as_bool(&self) -> Option<bool>

bool for Bool.

Source

pub fn as_bytes(&self) -> Option<&[u8]>

&[u8] for Name and Str.

Source

pub fn as_array(&self) -> Option<&[Obj]>

Array elements for Arr.

Source

pub fn stream_data(&self) -> Option<&[u8]>

Raw stream bytes for Stream.

Trait Implementations§

Source§

impl Clone for Obj

Source§

fn clone(&self) -> Self

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 Obj

Source§

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

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

impl PartialEq for Obj

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Obj

Auto Trait Implementations§

§

impl Freeze for Obj

§

impl RefUnwindSafe for Obj

§

impl Send for Obj

§

impl Sync for Obj

§

impl Unpin for Obj

§

impl UnsafeUnpin for Obj

§

impl UnwindSafe for Obj

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

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.