pub enum Object {
Null,
Boolean(bool),
Integer(i64),
Real(f64),
String(PdfString),
Name(Vec<u8>),
Array(Vec<Object>),
Dictionary(Dictionary),
Stream(Stream),
Reference(ObjectId),
}Expand description
A PDF object: any value that can appear inside a document.
Real holds an f64, so the enum is PartialEq but not Eq.
Variants§
Null
null.
Boolean(bool)
true or false.
Integer(i64)
An integer, written without a decimal point.
Real(f64)
A real number, always written with a decimal point.
String(PdfString)
A string, literal or hex.
Name(Vec<u8>)
A name, stored decoded: no leading /, #xx escapes resolved.
Array(Vec<Object>)
An array.
Dictionary(Dictionary)
A dictionary.
Stream(Stream)
A stream, only valid as the value of an indirect object.
Reference(ObjectId)
An indirect reference, n g R.
Implementations§
Source§impl Object
impl Object
Sourcepub fn hex_string(bytes: impl Into<Vec<u8>>) -> Self
pub fn hex_string(bytes: impl Into<Vec<u8>>) -> Self
A hex string object.
Sourcepub fn array(items: impl IntoIterator<Item = Object>) -> Self
pub fn array(items: impl IntoIterator<Item = Object>) -> Self
An array object.
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
The integer value, if this is an integer.
Sourcepub fn as_dict(&self) -> Option<&Dictionary>
pub fn as_dict(&self) -> Option<&Dictionary>
The dictionary, if this is one.
Sourcepub fn as_reference(&self) -> Option<ObjectId>
pub fn as_reference(&self) -> Option<ObjectId>
The reference target, if this is a reference.
Sourcepub fn write_to(&self, out: &mut Vec<u8>)
pub fn write_to(&self, out: &mut Vec<u8>)
Append the serialized form of this object to out.
The output is the canonical text form used by this crate: names keep only regular characters, strings keep the format they were parsed with, reals always carry a decimal point, and containers separate their elements with single spaces.