pub struct VipsInstance {}Expand description
A singleton instance to manage libvips initialization and shutdown.
§Example
use vips::*;
fn main() -> Result<()> {
let _instance = VipsInstance::new("app_test", true)?;
// Your libvips code here
Ok(())
}Implementations§
Source§impl VipsInstance
impl VipsInstance
Sourcepub fn new(name: &str, leak_test: bool) -> Result<VipsInstance>
pub fn new(name: &str, leak_test: bool) -> Result<VipsInstance>
Create a new VipsInstance, initializing libvips. This can only be done once per program execution. Subsequent attempts will return an error.
§Arguments
name- Application name for libvips initialization.leak_test- If true, enables leak testing in libvips.
§Errors
Returns an error if an instance already exists.
§Example
use vips::*;
fn main() -> Result<()> {
let _instance = VipsInstance::new("app_test", true)?;
// Your libvips code here
Ok(())
}§Safety Note
Shutdown Timing:
The libvips library is automatically shut down when the VipsInstance is dropped (typically
at the end of main()). Any operations referencing libvips after this point
(such as in other static destructors or background threads) may result in undefined behavior.
To avoid this, ensure all libvips operations are completed before the Vips Instance is dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VipsInstance
impl RefUnwindSafe for VipsInstance
impl Send for VipsInstance
impl Sync for VipsInstance
impl Unpin for VipsInstance
impl UnwindSafe for VipsInstance
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