Enum lopdf::Object

source ·
pub enum Object {
    Null,
    Boolean(bool),
    Integer(i64),
    Real(f32),
    Name(Vec<u8>),
    String(Vec<u8>, StringFormat),
    Array(Vec<Object>),
    Dictionary(Dictionary),
    Stream(Stream),
    Reference(ObjectId),
}
Expand description

Basic PDF object types defined in an enum.

Variants§

§

Null

§

Boolean(bool)

§

Integer(i64)

§

Real(f32)

§

Name(Vec<u8>)

§

String(Vec<u8>, StringFormat)

§

Array(Vec<Object>)

§

Dictionary(Dictionary)

§

Stream(Stream)

§

Reference(ObjectId)

Implementations§

source§

impl Object

source

pub fn string_literal<S: Into<Vec<u8>>>(s: S) -> Self

source

pub fn is_null(&self) -> bool

source

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

source

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

source

pub fn as_f32(&self) -> Result<f32>

source

pub fn as_float(&self) -> Result<f32>

Get the object value as a float. Unlike as_f64() this will also cast an Integer to a Real.

source

pub fn as_name(&self) -> Result<&[u8]>

source

pub fn as_name_str(&self) -> Result<&str>

source

pub fn as_str(&self) -> Result<&[u8]>

source

pub fn as_str_mut(&mut self) -> Result<&mut Vec<u8>>

source

pub fn as_string(&self) -> Result<Cow<'_, str>>

source

pub fn as_reference(&self) -> Result<ObjectId>

source

pub fn as_array(&self) -> Result<&Vec<Object>>

source

pub fn as_array_mut(&mut self) -> Result<&mut Vec<Object>>

source

pub fn as_dict(&self) -> Result<&Dictionary>

source

pub fn as_dict_mut(&mut self) -> Result<&mut Dictionary>

source

pub fn as_stream(&self) -> Result<&Stream>

source

pub fn as_stream_mut(&mut self) -> Result<&mut Stream>

source

pub fn type_name(&self) -> Result<&str>

source§

impl Object

Trait Implementations§

source§

impl Clone for Object

source§

fn clone(&self) -> Object

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Object

source§

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

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

impl<'a> From<&'a str> for Object

source§

fn from(name: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<(u32, u16)> for Object

source§

fn from(id: ObjectId) -> Self

Converts to this type from the input type.
source§

impl From<DateTime<Local>> for Object

source§

fn from(date: DateTime<Local>) -> Self

Converts to this type from the input type.
source§

impl From<DateTime<Utc>> for Object

source§

fn from(date: DateTime<Utc>) -> Self

Converts to this type from the input type.
source§

impl From<Dictionary> for Object

source§

fn from(dict: Dictionary) -> Self

Converts to this type from the input type.
source§

impl From<OffsetDateTime> for Object

source§

fn from(date: OffsetDateTime) -> Self

Converts to this type from the input type.
source§

impl From<Stream> for Object

source§

fn from(stream: Stream) -> Self

Converts to this type from the input type.
source§

impl From<String> for Object

source§

fn from(name: String) -> Self

Converts to this type from the input type.
source§

impl From<Time> for Object

source§

fn from(date: Time) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Object, Global>> for Object

source§

fn from(array: Vec<Object>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Object

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Object

source§

fn from(number: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Object

source§

fn from(number: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Object

source§

fn from(number: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Object

source§

fn from(number: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Object

source§

fn from(number: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Object

source§

fn from(number: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Object

source§

fn from(number: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Object

source§

fn from(number: u32) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Object

source§

fn from(number: u8) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.