pub struct VipsSource { /* private fields */ }Expand description
A unified interface for reading, seeking, and mapping data
Implementations§
Source§impl VipsSource
impl VipsSource
Sourcepub fn new_from_reader<R: Reader>(input: R) -> Result<VipsSource>
pub fn new_from_reader<R: Reader>(input: R) -> Result<VipsSource>
Create a target from a reader.
Sourcepub fn new_from_descriptor(descriptor: i32) -> Result<VipsSource>
pub fn new_from_descriptor(descriptor: i32) -> Result<VipsSource>
Create an source attached to a file descriptor. descriptor is closed with close() when source is finalized.
Sourcepub fn new_from_file<P: AsRef<Path>>(filename: P) -> Result<VipsSource>
pub fn new_from_file<P: AsRef<Path>>(filename: P) -> Result<VipsSource>
Create a source attached to a file.
Sourcepub fn new_from_memory(buffer: &[u8]) -> Result<VipsSource>
pub fn new_from_memory(buffer: &[u8]) -> Result<VipsSource>
Create a source attached to an area of memory. You must not free data while the source is active.
Sourcepub fn new_from_options(option_str: &str) -> Result<VipsSource>
pub fn new_from_options(option_str: &str) -> Result<VipsSource>
Create a source from an option string.
Sourcepub fn minimise(&mut self)
pub fn minimise(&mut self)
Minimise the source. As many resources as can be safely removed are removed.
Sourcepub fn unminimise(&mut self) -> Result<()>
pub fn unminimise(&mut self) -> Result<()>
Restore the source after minimisation. This is called at the start of every source method, so loaders should not usually need this.
Sourcepub fn decode(&mut self) -> Result<()>
pub fn decode(&mut self) -> Result<()>
Signal the end of header read and the start of the pixel decode phase. After this, you can no longer seek on this source.
Sourcepub fn read(&mut self, length: u64) -> Result<Vec<u8>>
pub fn read(&mut self, length: u64) -> Result<Vec<u8>>
Read up to length bytes from source and store the bytes in buffer.
Sourcepub fn is_mappable(&self) -> bool
pub fn is_mappable(&self) -> bool
Whether the source can be efficiently mapped into memory.
Sourcepub fn map(&self) -> Result<Vec<u8>>
pub fn map(&self) -> Result<Vec<u8>>
Map the source entirely into memory and return a pointer to the start.