pub struct ResourceManager { /* private fields */ }Expand description
Resource manager for efficient PDF object caching.
The ResourceManager provides centralized caching of PDF objects to avoid repeated parsing and to share resources between different parts of the document. It uses RefCell for interior mutability, allowing multiple immutable references to the document while still being able to update the cache.
§Caching Strategy
- Objects are cached on first access
- Cache persists for the lifetime of the document
- Manual cache clearing is supported for memory management
§Example
use oxidize_pdf::parser::document::ResourceManager;
let resources = ResourceManager::new();
// Objects are cached automatically when accessed through PdfDocument
// Manual cache management:
resources.clear_cache(); // Free memory when neededImplementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn cache_object(&self, obj_ref: (u32, u16), obj: PdfObject)
pub fn cache_object(&self, obj_ref: (u32, u16), obj: PdfObject)
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all cached objects to free memory.
Use this when processing large documents to manage memory usage.
§Example
// After processing many pages
resources.clear_cache();
println!("Cache cleared to free memory");Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ResourceManager
impl !RefUnwindSafe for ResourceManager
impl Send for ResourceManager
impl !Sync for ResourceManager
impl Unpin for ResourceManager
impl UnwindSafe for ResourceManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().