Primitive

Enum Primitive 

Source
pub enum Primitive {
    Null,
    Integer(i32),
    Number(f32),
    Boolean(bool),
    String(PdfString),
    Stream(PdfStream),
    Dictionary(Dictionary),
    Array(Vec<Primitive>),
    Reference(PlainRef),
    Name(SmallString),
}

Variants§

§

Null

§

Integer(i32)

§

Number(f32)

§

Boolean(bool)

§

String(PdfString)

§

Stream(PdfStream)

§

Dictionary(Dictionary)

§

Array(Vec<Primitive>)

§

Reference(PlainRef)

§

Name(SmallString)

Implementations§

Source§

impl Primitive

Source

pub fn serialize(&self, out: &mut impl Write) -> Result<()>

Source

pub fn array<O, T, I, U>(i: I, update: &mut U) -> Result<Primitive>
where O: ObjectWrite, I: Iterator<Item = T>, T: Borrow<O>, U: Updater,

Source

pub fn name(name: impl Into<SmallString>) -> Primitive

Source§

impl Primitive

Source

pub fn get_debug_name(&self) -> &'static str

For debugging / error messages: get the name of the variant

Source

pub fn resolve(self, r: &impl Resolve) -> Result<Primitive>

resolve the primitive if it is a refernce, otherwise do nothing

Source

pub fn as_integer(&self) -> Result<i32>

Source

pub fn as_u8(&self) -> Result<u8>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn as_string(&self) -> Result<&PdfString>

Source

pub fn as_array(&self) -> Result<&[Primitive]>

Source

pub fn into_reference(self) -> Result<PlainRef>

Source

pub fn into_array(self) -> Result<Vec<Primitive>>

Source

pub fn into_dictionary(self) -> Result<Dictionary>

Source

pub fn into_name(self) -> Result<Name>

Source

pub fn into_string(self) -> Result<PdfString>

Source

pub fn to_string_lossy(&self) -> Result<String>

Source

pub fn to_string(&self) -> Result<String>

Source

pub fn into_stream(self, _r: &impl Resolve) -> Result<PdfStream>

Trait Implementations§

Source§

impl Clone for Primitive

Source§

fn clone(&self) -> Primitive

Returns a duplicate 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 DataSize for Primitive

Source§

const IS_DYNAMIC: bool = true

If true, the type has a heap size that can vary at runtime, depending on the actual value.
Source§

const STATIC_HEAP_SIZE: usize = 112usize

The amount of space a value of the type always occupies. If IS_DYNAMIC is false, this is the total amount of heap memory occupied by the value. Otherwise this is a lower bound.
Source§

fn estimate_heap_size(&self) -> usize

Estimates the size of heap memory taken up by this value. Read more
Source§

impl Debug for Primitive

Source§

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

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

impl DeepClone for Primitive

Source§

fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self>

Source§

impl Display for Primitive

Source§

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

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

impl From<Dictionary> for Primitive

Source§

fn from(x: Dictionary) -> Primitive

Converts to this type from the input type.
Source§

impl From<Name> for Primitive

Source§

fn from(Name: Name) -> Primitive

Converts to this type from the input type.
Source§

impl From<PdfStream> for Primitive

Source§

fn from(x: PdfStream) -> Primitive

Converts to this type from the input type.
Source§

impl From<PdfString> for Primitive

Source§

fn from(x: PdfString) -> Primitive

Converts to this type from the input type.
Source§

impl From<PlainRef> for Primitive

Source§

fn from(x: PlainRef) -> Primitive

Converts to this type from the input type.
Source§

impl<T> From<RcRef<T>> for Primitive

Source§

fn from(value: RcRef<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Primitive>> for Primitive

Source§

fn from(x: Vec<Primitive>) -> Primitive

Converts to this type from the input type.
Source§

impl From<bool> for Primitive

Source§

fn from(x: bool) -> Primitive

Converts to this type from the input type.
Source§

impl From<f32> for Primitive

Source§

fn from(x: f32) -> Primitive

Converts to this type from the input type.
Source§

impl From<i32> for Primitive

Source§

fn from(x: i32) -> Primitive

Converts to this type from the input type.
Source§

impl Object for Primitive

Source§

fn from_primitive(p: Primitive, _: &impl Resolve) -> Result<Self>

Convert primitive to Self
Source§

impl ObjectWrite for Primitive

Source§

fn to_primitive(&self, _: &mut impl Updater) -> Result<Primitive>

Source§

impl PartialEq for Primitive

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Trace for Primitive

Source§

fn trace(&self, cb: &mut impl FnMut(PlainRef))

Source§

impl<'a> TryInto<&'a [Primitive]> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<&'a [Primitive]>

Performs the conversion.
Source§

impl<'a> TryInto<&'a [u8]> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<&'a [u8]>

Performs the conversion.
Source§

impl<'a> TryInto<Cow<'a, str>> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<Cow<'a, str>>

Performs the conversion.
Source§

impl<'a> TryInto<Name> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<Name>

Performs the conversion.
Source§

impl<'a> TryInto<String> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<String>

Performs the conversion.
Source§

impl<'a> TryInto<f32> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<f32>

Performs the conversion.
Source§

impl<'a> TryInto<i32> for &'a Primitive

Source§

type Error = PdfError

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

fn try_into(self) -> Result<i32>

Performs the conversion.
Source§

impl StructuralPartialEq for Primitive

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.