Repository: J-F-Liu/lopdf (language: rust)

Issue:
FEATURE REQUEST: exposing `entry` and other methods to `Dictionary`
Hello,

First, many thanks for this great work!

I wrote a small project, [rpdf](https://github.com/jeertmans/rpdf), that uses your crate to deal with PDFs, and I felt like it had a few limitations.

The main one it that `Dictionary` only implements a few of the methods of `LinkedHashMap`. And the one I am particularly interested in is [`entry`](https://docs.rs/linked-hash-map/latest/linked_hash_map/struct.LinkedHashMap.html#method.entry).

Is there a specific reason why `Dictionary` does not implement `Deref<Target = LinkedHashMap>`?
Or that the inner attribute is private?

Thanks in advance!


Discussion / hints:
Because previously there is no such a need, it's ok to add an `as_hashmap` or `to_hashmap` convertion method.

Fix patch:
diff --git a/src/object.rs b/src/object.rs
index fbcb2b0..c840f6e 100644
--- a/src/object.rs
+++ b/src/object.rs
@@ -111,8 +111,8 @@ impl From<Vec<Object>> for Object {
 }
 
 impl From<Dictionary> for Object {
-    fn from(dcit: Dictionary) -> Self {
-        Object::Dictionary(dcit)
+    fn from(dict: Dictionary) -> Self {
+        Object::Dictionary(dict)
     }
 }
 
@@ -422,6 +422,17 @@ impl Dictionary {
 
         self.0 = new_dict;
     }
+
+    /// Return a reference to the inner  [`LinkedHashMap`].
+    pub fn as_hashmap(&self) -> &LinkedHashMap<Vec<u8>, Object> {
+        &self.0
+    }
+
+
+    /// Return a mut reference to the inner [`LinkedHashMap`].
+    pub fn as_hashmap_mut(&mut self) -> &mut LinkedHashMap<Vec<u8>, Object> {
+        &mut self.0
+    }
 }
 
 #[macro_export]


Test patch: