Expand description
vips-rs: Lightweight safety encapsulation of libvips (infrastructure such as initialization, concurrency, caching, versioning, etc.)
Characteristics:
- Remove ‘lazy_static’ and complete the global initialization with the standard library ‘OnceLock’;
- Provide ‘init()’/‘is_initialized()’, concurrency/cache control, version information;
- Unified error handling (grab ‘vips_error_buffer()’);
- Documentation examples with basic tests.
Usage examples:
use vips::{init, set_concurrency};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// initialization (idempotent), recommended to call as early as possible
init(Some("my-app"))?;
// Configure concurrency (default = number of CPU cores)
vips::set_concurrency(4);
// Tuning the cache
vips::set_max_operations(1000);
vips::set_max_mem_bytes(256 * 1024 * 1024);
vips::set_max_files(100);
Ok(())
}Structs§
- Vips
Image - Representation of a libvips image.
This struct wraps a raw pointer to a
VipsImagefrom the libvips C library. It provides methods for creating, manipulating, and destroying images. - Vips
Instance - A singleton instance to manage libvips initialization and shutdown.
- Vips
Interpolate - VipsInterpolate struct wrapping libvips VipsInterpolate
- Vips
Interpolate Method - Function pointer type for VipsInterpolateMethod
- Vips
Region - VipsRegion struct wrapping libvips VipsRegion
Enums§
- Error
- Vips
Access - Vips
Align - Vips
Angle - Vips
Angle45 - Vips
Argument Flags - Vips
Band Format - Vips
Blend Mode - Vips
Coding - Vips
Combine - Vips
Combine Mode - Vips
Compass Direction - Vips
Demand Style - Vips
Direction - Vips
Extend - Vips
Foreign DzContainer - Vips
Foreign DzDepth - Vips
Foreign DzLayout - Vips
Foreign Flags - Vips
Foreign PngFilter - Vips
Foreign Tiff Compression - Vips
Foreign Tiff Predictor - Vips
Foreign Tiff Resunit - Vips
Foreign Webp Preset - Vips
Format Flags - Vips
Image Type - Vips
Intent - Vips
Interesting - Vips
Interpretation - Vips
Kernel - Vips
Operation Boolean - Vips
Operation Complex - Vips
Operation Complex2 - Vips
Operation Complexget - Vips
Operation Flags - Vips
Operation Math - Vips
Operation Math2 - Vips
Operation Morphology - Vips
Operation Relational - Vips
Operation Round - VipsPCS
- Vips
Precision - Vips
Size - Vips
Token
Traits§
- Vips
Buffer - Extension trait for thumbnailing from a byte buffer
Functions§
- call⚠
- code_
to_ result - Convert the return code (0=OK, non-0=ERR) convention in libvips to Result
- concurrency
- Get the current concurrency
- init
- Initialize libvips (idempotent).
app_namecan be used for logging and diagnostic display. Ifapp_nameisNone, a default name “vips-rs” will be used. - is_
initialized - Is it currently initialized?
- max_
files - Get the maximum number of files configured
- max_
mem_ bytes - Get the maximum cache memory (bytes) configured
- max_
operations - Gets the maximum number of compute nodes configured
- set_
concurrency - Set concurrency (<=0 will fall back to default)
- set_
max_ files - Set the maximum number of files allowed to open at the same time
- set_
max_ mem_ bytes - Set the maximum memory allowed in bytes for the cache
- set_
max_ operations - Sets the maximum number of compute nodes that can be retained in the cache
- set_
trace - Print the diagnostic information for each cache hit/build (1 on, 0 off)
- size_
operations - Gets the number of compute nodes in the current cache
- take_
vips_ error - Read and empty the error buffer of libvips
- tracked_
mem_ bytes - Currently tracked memory (bytes)
- tracked_
mem_ highwater_ bytes - Historical Peak Memory Usage (bytes)
- version
- Returns the libvips version as a tuple: (major, minor, micro)
- version_
string - Returns the full version string, such as “8.14.2”