Skip to content

Commit

Permalink
fix lazy clone
Browse files Browse the repository at this point in the history
  • Loading branch information
s3bk committed Jan 4, 2025
1 parent 37ca9db commit 0928caa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pdf/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,19 @@ impl<T> PartialEq for MaybeRef<T> {
}
impl<T> Eq for MaybeRef<T> {}

#[derive(Debug, Clone, DataSize)]
#[derive(Debug, DataSize)]
pub struct Lazy<T> {
primitive: Primitive,
_marker: PhantomData<T>
}
impl<T> Clone for Lazy<T> {
fn clone(&self) -> Self {
Lazy {
primitive: self.primitive.clone(),
_marker: PhantomData
}
}
}
impl<T: Object> Lazy<T> {
pub fn load(&self, resolve: &impl Resolve) -> Result<T> {
T::from_primitive(self.primitive.clone(), resolve)
Expand Down

0 comments on commit 0928caa

Please sign in to comment.