pub enum Object {
Null,
Boolean(bool),
Integer(i64),
Real(f64),
String(PdfString),
Name(Name),
Array(Vec<Object>),
Dictionary(HashMap<Name, Object>),
Stream {
dict: HashMap<Name, Object>,
data: StreamData,
},
Reference(ObjectId),
}Expand description
A PDF object value.
Object::Reference holds an unresolved indirect reference — it is not
recursively resolved at parse time to avoid OnceLock deadlocks.
Variants§
Null
The PDF null object.
Boolean(bool)
A boolean value.
Integer(i64)
An integer number.
Real(f64)
A real (floating-point) number.
String(PdfString)
A PDF string (encoding-aware).
Name(Name)
A PDF name.
Array(Vec<Object>)
An array of objects.
Dictionary(HashMap<Name, Object>)
A dictionary mapping names to objects.
Stream
A stream object with dictionary metadata and raw data reference.
Reference(ObjectId)
An unresolved indirect reference to another object.
Implementations§
Source§impl Object
impl Object
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the floating-point value if this is Object::Real or Object::Integer.
Sourcepub fn as_string(&self) -> Option<&PdfString>
pub fn as_string(&self) -> Option<&PdfString>
Returns a reference to the PdfString if this is Object::String.
Sourcepub fn as_name(&self) -> Option<&Name>
pub fn as_name(&self) -> Option<&Name>
Returns a reference to the Name if this is Object::Name.
Sourcepub fn as_array(&self) -> Option<&[Object]>
pub fn as_array(&self) -> Option<&[Object]>
Returns a reference to the array if this is Object::Array.
Sourcepub fn as_dict(&self) -> Option<&HashMap<Name, Object>>
pub fn as_dict(&self) -> Option<&HashMap<Name, Object>>
Returns a reference to the dictionary if this is Object::Dictionary.
Sourcepub fn as_stream_dict(&self) -> Option<&HashMap<Name, Object>>
pub fn as_stream_dict(&self) -> Option<&HashMap<Name, Object>>
Returns a reference to the stream dictionary if this is Object::Stream.
Sourcepub fn as_reference(&self) -> Option<ObjectId>
pub fn as_reference(&self) -> Option<ObjectId>
Returns the ObjectId if this is Object::Reference.
Sourcepub fn as_dict_mut(&mut self) -> Option<&mut HashMap<Name, Object>>
pub fn as_dict_mut(&mut self) -> Option<&mut HashMap<Name, Object>>
Returns a mutable reference to the dictionary if this is Object::Dictionary.
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Object>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Object>>
Returns a mutable reference to the array if this is Object::Array.
Sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Returns true if this is Object::Reference.