try_lib

Function try_lib 

Source
pub fn try_lib() -> PdfiumResult<PdfiumGuard>
Expand description

Access to the PDFium dynamic library with thread-safe reentrant locking

This function will return an error if the library is not available. If the library is not available, future calls to this function will also fail. Testing for the existence of the library is only done once in the lifetime of the application.

The returned PdfiumGuard ensures that only one thread can access the library at a time, but the same thread can acquire the lock multiple times (reentrant behavior). The guard will automatically release the lock when it goes out of scope.

Reentrant behavior: If the same thread calls this function multiple times while already holding a guard, it will succeed without deadlocking. However, each call must be matched with a corresponding drop of the guard.