pub struct PdfDictionary { /* private fields */ }Expand description
A PDF dictionary backed by an FxHashMap. PDF names are short strings, so
the faster non-cryptographic hasher costs little in practice while speeding
up both parsing and serialization. The hasher is not collision-resistant,
but dictionaries parsed from untrusted input are bounded by the parser’s
max_dict_entries limit, which caps the worst-case collision cost.
Implementations§
Source§impl PdfDictionary
impl PdfDictionary
pub fn new() -> Self
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a dictionary with room for capacity entries, avoiding the
rehash/regrow work when the size is known up front (hot path in
document building).
pub fn insert(&mut self, key: &str, value: PdfObject)
pub fn get(&self, key: &str) -> Option<&PdfObject>
pub fn get_name(&self, key: &str) -> Option<&PdfName>
pub fn get_integer(&self, key: &str) -> Option<i64>
pub fn get_array(&self, key: &str) -> Option<&PdfArray>
pub fn get_dict(&self, key: &str) -> Option<&PdfDictionary>
Sourcepub fn get_string_bytes(&self, key: &str) -> Option<&[u8]>
pub fn get_string_bytes(&self, key: &str) -> Option<&[u8]>
Returns the raw bytes of a string entry, if the value is a PdfString.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&PdfName, &PdfObject)>
Trait Implementations§
Source§impl Clone for PdfDictionary
impl Clone for PdfDictionary
Source§fn clone(&self) -> PdfDictionary
fn clone(&self) -> PdfDictionary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PdfDictionary
impl Debug for PdfDictionary
Source§impl Default for PdfDictionary
impl Default for PdfDictionary
Source§impl PartialEq for PdfDictionary
impl PartialEq for PdfDictionary
impl StructuralPartialEq for PdfDictionary
Auto Trait Implementations§
impl Freeze for PdfDictionary
impl RefUnwindSafe for PdfDictionary
impl Send for PdfDictionary
impl Sync for PdfDictionary
impl Unpin for PdfDictionary
impl UnsafeUnpin for PdfDictionary
impl UnwindSafe for PdfDictionary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more