### starts_with Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Checks if the slice starts with the provided needle. ```APIDOC ## starts_with ### Description Returns true if needle is a prefix of the slice or equal to the slice. ### Parameters - **needle** (&[T]) - Required - The prefix to check. ### Response - **bool** - True if the slice starts with the needle. ``` -------------------------------- ### as_array Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Gets a reference to the underlying array. ```APIDOC ## as_array ### Description Gets a reference to the underlying array. Returns None if N does not match the slice length. ### Parameters #### Path Parameters - **N** (usize) - Required - The expected length of the array. ### Response #### Success Response (200) - **Option<&[T; N]>** - The array reference. ``` -------------------------------- ### Get Camera Settings Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves camera-specific settings such as ISO speed, shutter speed, aperture, and focal length. ```rust pub fn iso_speed(&self) -> u32 ``` ```rust pub fn shutter(&self) -> f32 ``` ```rust pub fn aperture(&self) -> f32 ``` ```rust pub fn focal_len(&self) -> f32 ``` -------------------------------- ### Get Raw and DNG Version Info Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves the count of raw image files and the DNG version number. ```rust pub fn raw_count(&self) -> u32 ``` ```rust pub fn dng_version(&self) -> u32 ``` -------------------------------- ### Get Image Format Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the image format of the processed image. ```rust pub fn image_format(&self) -> ImageFormat ``` -------------------------------- ### Get Color Information Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Returns the number of color channels in the raw image. ```rust pub fn colors(&self) -> i32 ``` -------------------------------- ### Get Date and Time Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves the date and time the image was taken, if available. Returns an Option containing a DateTime. ```rust pub fn datetime(&self) -> Option> ``` -------------------------------- ### Get Lens and Full Info Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves detailed lens information and comprehensive raw image data. ```rust pub fn lens_info(&self) -> LensInfo ``` ```rust pub fn full_info(&self) -> FullRawInfo ``` -------------------------------- ### Verify slice prefixes with starts_with Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns true if the slice starts with the provided needle. Always returns true for empty needles. ```rust let v = [10, 40, 30]; assert!(v.starts_with(&[10])); assert!(v.starts_with(&[10, 40])); assert!(v.starts_with(&v)); assert!(!v.starts_with(&[50])); assert!(!v.starts_with(&[10, 50])); ``` ```rust let v = &[10, 40, 30]; assert!(v.starts_with(&[])); let v: &[u8] = &[]; assert!(v.starts_with(&[])); ``` -------------------------------- ### as_chunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into a slice of N-element arrays starting from the beginning. ```APIDOC ## as_chunks ### Description Splits the slice into a slice of N-element arrays, starting at the beginning of the slice, and a remainder slice with length strictly less than N. ### Parameters #### Path Parameters - **N** (usize) - Required - The size of the arrays in the resulting slice. ### Response - **chunks** (&[[T; N]]) - A slice of N-element arrays. - **remainder** (&[T]) - The remaining elements that did not fit into a full N-element array. ``` -------------------------------- ### Get Slice Length Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns the number of elements in the slice. The example demonstrates getting the length of an array. ```rust pub fn len(&self) -> usize ``` -------------------------------- ### Get First Element Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns the first element of the slice, or `None` if it is empty. Examples show retrieving the first element from a populated slice and handling an empty slice. ```rust pub fn first(&self) -> Option<&T> ``` -------------------------------- ### Get First Chunk of Slice Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an array reference to the first `N` items in the slice. If the slice is not at least `N` in length, this will return `None`. Examples show successful retrieval, failure due to insufficient length, and retrieval of a zero-length chunk. ```rust pub fn first_chunk(&self) -> Option<&[T; N]> ``` -------------------------------- ### Get Image Metadata Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves various metadata strings from the raw image, including artist, description, camera make, model, software version, and normalized versions of make and model. ```rust pub fn artist(&self) -> Cow<'_, str> ``` ```rust pub fn desc(&self) -> Cow<'_, str> ``` ```rust pub fn make(&self) -> Cow<'_, str> ``` ```rust pub fn model(&self) -> Cow<'_, str> ``` ```rust pub fn normalized_make(&self) -> Cow<'_, str> ``` ```rust pub fn normalized_model(&self) -> Cow<'_, str> ``` ```rust pub fn software(&self) -> Cow<'_, str> ``` -------------------------------- ### get Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns a reference to an element or subslice depending on the type of index. ```APIDOC ## get ### Description Returns a reference to an element or subslice depending on the type of index. If the index is out of bounds, returns None. ### Parameters #### Path Parameters - **index** (I) - Required - The index or range to access. ### Response #### Success Response (200) - **Option<&>::Output>** - The element or subslice at the specified index. ``` -------------------------------- ### Get Image Width Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the width of the processed image. ```rust pub fn width(&self) -> u32 ``` -------------------------------- ### Get Image Dimensions Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves the width and height of the raw image in pixels. ```rust pub fn width(&self) -> u32 ``` ```rust pub fn height(&self) -> u32 ``` -------------------------------- ### Get Image Height Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the height of the processed image. ```rust pub fn height(&self) -> u32 ``` -------------------------------- ### Get GPS Information Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Retrieves the GPS metadata associated with the raw image. ```rust pub fn gps(&self) -> GpsInfo ``` -------------------------------- ### Get Image Colors Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the number of colors in the processed image. ```rust pub fn colors(&self) -> u16 ``` -------------------------------- ### as_rchunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into a slice of N-element arrays starting from the end. ```APIDOC ## as_rchunks ### Description Splits the slice into a slice of N-element arrays, starting at the end of the slice, and a remainder slice with length strictly less than N. ### Parameters #### Path Parameters - **N** (usize) - Required - The size of the arrays in the resulting slice. ### Response - **remainder** (&[T]) - The remaining elements at the beginning of the slice. - **chunks** (&[[T; N]]) - A slice of N-element arrays. ``` -------------------------------- ### Get Pixel Count Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Returns the total number of pixels in the raw image. ```rust pub fn pixels(&self) -> u32 ``` -------------------------------- ### Split Slice into First and Rest Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns the first and all the rest of the elements of the slice, or `None` if it is empty. The example demonstrates splitting a slice and accessing the first element and the remaining slice. ```rust pub fn split_first(&self) -> Option<(&T, &[T])> ``` -------------------------------- ### Get Raw Data Size Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the size of the raw image data in bytes. ```rust pub fn data_size(&self) -> usize ``` -------------------------------- ### Split slice into chunks from the end with as_rchunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into N-element arrays starting from the end. Panics if N is zero. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let (remainder, chunks) = slice.as_rchunks(); assert_eq!(remainder, &['l']); assert_eq!(chunks, &[['o', 'r'], ['e', 'm']]); ``` -------------------------------- ### Get Immutable libraw_data_t Reference Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Provides immutable access to the underlying libraw_data_t structure. ```rust fn as_ref(&self) -> &libraw_data_t ``` -------------------------------- ### SIMD Slice Operations with `as_simd` Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Demonstrates splitting a slice into SIMD-compatible prefix, middle, and suffix parts. Useful for vectorized operations where data might not perfectly align with SIMD lane sizes. ```rust #![feature(portable_simd)] use core::simd::prelude::*; let short = &[1, 2, 3]; let (prefix, middle, suffix) = short.as_simd::<4>(); assert_eq!(middle, []); // Not enough elements for anything in the middle // They might be split in any possible way between prefix and suffix let it = prefix.iter().chain(suffix).copied(); assert_eq!(it.collect::>(), vec![1, 2, 3]); fn basic_simd_sum(x: &[f32]) -> f32 { use std::ops::Add; let (prefix, middle, suffix) = x.as_simd(); let sums = f32x4::from_array([ prefix.iter().copied().sum(), 0.0, 0.0, suffix.iter().copied().sum(), ]); let sums = middle.iter().copied().fold(sums, f32x4::add); sums.reduce_sum() } let numbers: Vec = (1..101).map(|x| x as _).collect(); assert_eq!(basic_simd_sum(&numbers[1..99]), 4949.0); ``` -------------------------------- ### Get Last Element Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns the last element of the slice, or `None` if it is empty. Examples show retrieving the last element from a populated slice and handling an empty slice. ```rust pub fn last(&self) -> Option<&T> ``` -------------------------------- ### Split Slice into Last and Rest Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns the last and all the rest of the elements of the slice, or `None` if it is empty. The example demonstrates splitting a slice and accessing the last element and the preceding slice. ```rust pub fn split_last(&self) -> Option<(&T, &[T])> ``` -------------------------------- ### From for Mounts Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.Mounts.html Converts a LibRaw_camera_mounts type into the Mounts struct. ```APIDOC ## impl From for Mounts ### Description Converts a raw LibRaw_camera_mounts value into a Mounts struct instance. ### Parameters - **mounts** (LibRaw_camera_mounts) - Required - The raw mount value to convert. ``` -------------------------------- ### Enable Half Size Output Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Enables or disables ultra-fast pixel binning output. This setting must be applied before calling `unpack()`. ```rust pub fn set_half_size(&mut self, enable: bool) ``` -------------------------------- ### Open Raw Image Buffer Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Opens a raw image from a byte slice. This is the entry point for processing raw image data. ```rust pub fn open(buf: &[u8]) -> Result ``` -------------------------------- ### Implement StructuralPartialEq for ThumbFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Enables structural equality comparison for ThumbFormat. This is often derived and used for comparing types based on their structure. ```rust impl StructuralPartialEq for ThumbFormat ``` -------------------------------- ### Implement PartialEq for ImageFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ImageFormat.html Enables comparison of ImageFormat values for equality and inequality. ```rust fn eq(&self, other: &ImageFormat) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### rchunks_exact Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator over chunks of exactly chunk_size starting from the end. ```APIDOC ## rchunks_exact ### Description Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice. If chunk_size does not divide the length, the remainder is omitted from the iterator. ### Parameters #### Query Parameters - **chunk_size** (usize) - Required - The size of each chunk. ### Response - **iterator** (RChunksExact<'_, T>) - An iterator over the chunks. ``` -------------------------------- ### rchunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator over chunks of size chunk_size starting from the end. ```APIDOC ## rchunks ### Description Returns an iterator over chunk_size elements of the slice at a time, starting at the end of the slice. The chunks are slices and do not overlap. ### Parameters #### Query Parameters - **chunk_size** (usize) - Required - The size of each chunk. ### Response - **iterator** (RChunks<'_, T>) - An iterator over the chunks. ``` -------------------------------- ### Implement StructuralPartialEq for ImageFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ImageFormat.html Enables structural equality comparison for ImageFormat. ```rust impl StructuralPartialEq for ImageFormat ``` -------------------------------- ### RawImage Struct and Methods Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Provides details on creating and manipulating RawImage objects. ```APIDOC ## RawImage Struct Represents a raw image file that can be processed. ### Fields (Private fields, not directly accessible) ## Methods ### `open(buf: &[u8]) -> Result` Opens a raw image from a byte buffer. - **Method**: `pub fn open` - **Parameters**: - `buf` (*&[u8]*) - A byte slice containing the raw image data. - **Returns**: `Result` - Ok containing a `RawImage` instance on success, or an `Error` on failure. ### `unpack(&mut self) -> Result<(), Error>` Unpacks the raw image data, making pixel data accessible. - **Method**: `pub fn unpack` - **Returns**: `Result<(), Error>` - Ok on success, or an `Error` on failure. ### `extract_thumbs(&mut self) -> Result, Error>` Extracts thumbnail images embedded within the raw file. - **Method**: `pub fn extract_thumbs` - **Returns**: `Result, Error>` - Ok containing a vector of `ThumbnailImage` on success, or an `Error` on failure. ### `set_half_size(enable: bool)` Enables or disables ultra-fast pixel binning output. Must be called before `unpack()`. - **Method**: `pub fn set_half_size` - **Parameters**: - `enable` (*bool*) - `true` to enable half size output, `false` otherwise. ### `width(&self) -> u32` Returns the width of the raw image. - **Method**: `pub fn width` - **Returns**: `u32` - The image width. ### `height(&self) -> u32` Returns the height of the raw image. - **Method**: `pub fn height` - **Returns**: `u32` - The image height. ### `pixels(&self) -> u32` Returns the total number of pixels in the raw image. - **Method**: `pub fn pixels` - **Returns**: `u32` - The total pixel count. ### `colors(&self) -> i32` Returns the number of color channels. - **Method**: `pub fn colors` - **Returns**: `i32` - The number of color channels. ### `iso_speed(&self) -> u32` Returns the ISO speed of the image. - **Method**: `pub fn iso_speed` - **Returns**: `u32` - The ISO speed. ### `shutter(&self) -> f32` Returns the shutter speed. - **Method**: `pub fn shutter` - **Returns**: `f32` - The shutter speed. ### `aperture(&self) -> f32` Returns the aperture value. - **Method**: `pub fn aperture` - **Returns**: `f32` - The aperture value. ### `focal_len(&self) -> f32` Returns the focal length. - **Method**: `pub fn focal_len` - **Returns**: `f32` - The focal length. ### `datetime(&self) -> Option>` Returns the date and time the image was taken, if available. - **Method**: `pub fn datetime` - **Returns**: `Option>` - An Option containing the local date and time, or None. ### `gps(&self) -> GpsInfo` Returns the GPS information associated with the image. - **Method**: `pub fn gps` - **Returns**: `GpsInfo` - The GPS information. ### `artist(&self) -> Cow<'_, str>` Returns the artist information. - **Method**: `pub fn artist` - **Returns**: `Cow<'_, str>` - The artist name. ### `desc(&self) -> Cow<'_, str>` Returns the description of the image. - **Method**: `pub fn desc` - **Returns**: `Cow<'_, str>` - The image description. ### `make(&self) -> Cow<'_, str>` Returns the camera manufacturer (make). - **Method**: `pub fn make` - **Returns**: `Cow<'_, str>` - The camera manufacturer. ### `model(&self) -> Cow<'_, str>` Returns the camera model. - **Method**: `pub fn model` - **Returns**: `Cow<'_, str>` - The camera model. ### `normalized_make(&self) -> Cow<'_, str>` Returns the normalized camera manufacturer (make). - **Method**: `pub fn normalized_make` - **Returns**: `Cow<'_, str>` - The normalized camera manufacturer. ### `normalized_model(&self) -> Cow<'_, str>` Returns the normalized camera model. - **Method**: `pub fn normalized_model` - **Returns**: `Cow<'_, str>` - The normalized camera model. ### `software(&self) -> Cow<'_, str>` Returns the software version used to create the image. - **Method**: `pub fn software` - **Returns**: `Cow<'_, str>` - The software version. ### `raw_count(&self) -> u32` Returns the number of raw images in the file. - **Method**: `pub fn raw_count` - **Returns**: `u32` - The count of raw images. ### `dng_version(&self) -> u32` Returns the DNG version. - **Method**: `pub fn dng_version` - **Returns**: `u32` - The DNG version. ### `lens_info(&self) -> LensInfo` Returns information about the lens used. - **Method**: `pub fn lens_info` - **Returns**: `LensInfo` - The lens information. ### `full_info(&self) -> FullRawInfo` Returns comprehensive raw image information. - **Method**: `pub fn full_info` - **Returns**: `FullRawInfo` - The full raw image information. ### `set_use_camera_wb(enable: bool)` If possible, use the white balance from the camera. If not available, Auto-WB is used. - **Method**: `pub fn set_use_camera_wb` - **Parameters**: - `enable` (*bool*) - `true` to use camera white balance, `false` otherwise. ### `set_use_camera_matrix(enable: bool)` On by default, call if you want to force use of DNG embedded matrix. - **Method**: `pub fn set_use_camera_matrix` - **Parameters**: - `enable` (*bool*) - `true` to force use of DNG embedded matrix, `false` otherwise. ### `process(&mut self) -> Result, Error>` Processes the raw image data. The `D` const generic parameter likely relates to the output format or bit depth. - **Method**: `pub fn process` - **Type Parameters**: - `D` (*u32*) - A compile-time constant defining processing characteristics. - **Returns**: `Result, Error>` - Ok containing the processed image, or an `Error` on failure. ``` -------------------------------- ### Implement Clone for ThumbFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Allows creating a duplicate of a ThumbFormat value. This is useful when you need to copy the format without affecting the original. ```rust fn clone(&self) -> ThumbFormat ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Mounts::repr Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.Mounts.html Retrieves the string representation of the camera mount. ```APIDOC ## pub fn repr(&self) -> &'static str ### Description Returns a static string slice representing the camera mount. ### Method Rust Method ### Response - **return** (&'static str) - The string representation of the mount. ``` -------------------------------- ### Auto Trait Implementations for RawImage Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Details on automatic trait implementations for RawImage. ```APIDOC ## Auto Trait Implementations ### `impl Freeze for RawImage` ### `impl RefUnwindSafe for RawImage` ### `impl Unpin for RawImage` ### `impl UnsafeUnpin for RawImage` ### `impl UnwindSafe for RawImage` ``` -------------------------------- ### Set White Balance Preference Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Configures the image processing to use the white balance setting from the camera if available. Otherwise, Auto-WB is used. ```rust pub fn set_use_camera_wb(&mut self, enable: bool) ``` -------------------------------- ### Get Image Bits Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Retrieves the number of bits per pixel for the processed image. ```rust pub fn bits(&self) -> u16 ``` -------------------------------- ### Trait Implementations for RawImage Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Details on how RawImage implements standard Rust traits. ```APIDOC ## Trait Implementations ### `impl AsMut for RawImage` #### `fn as_mut(&mut self) -> &mut libraw_data_t` Converts this type into a mutable reference of the (usually inferred) input type `libraw_data_t`. - **Method**: `as_mut` - **Returns**: `&mut libraw_data_t` ### `impl AsRef for RawImage` #### `fn as_ref(&self) -> &libraw_data_t` Converts this type into a shared reference of the (usually inferred) input type `libraw_data_t`. - **Method**: `as_ref` - **Returns**: `&libraw_data_t` ### `impl Drop for RawImage` #### `fn drop(&mut self)` Executes the destructor for this type. This is called automatically when the value goes out of scope. - **Method**: `drop` ### `impl Send for RawImage` Indicates that `RawImage` can be safely transferred between threads. ### `impl Sync for RawImage` Indicates that `RawImage` can be safely shared between threads. ``` -------------------------------- ### Get Mutable libraw_data_t Reference Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Provides mutable access to the underlying libraw_data_t structure. ```rust fn as_mut(&mut self) -> &mut libraw_data_t ``` -------------------------------- ### Iterate over slice elements Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator that yields all items in the slice from start to end. ```rust let x = &[1, 2, 4]; let mut iterator = x.iter(); assert_eq!(iterator.next(), Some(&1)); assert_eq!(iterator.next(), Some(&2)); assert_eq!(iterator.next(), Some(&4)); assert_eq!(iterator.next(), None); ``` -------------------------------- ### rsplit Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator over subslices separated by elements that match a predicate, starting from the end of the slice. ```APIDOC ## rsplit(pred: F) ### Description Returns an iterator over subslices separated by elements that match `pred`, starting at the end of the slice and working backwards. The matched element is not contained in the subslices. ### Parameters - **pred** (FnMut(&T) -> bool) - Required - The predicate function to determine split points. ### Response - **RSplit<'_, T, F>** - An iterator over the subslices. ``` -------------------------------- ### as_ptr Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns a raw pointer to the slice’s buffer. ```APIDOC ## as_ptr ### Description Returns a raw pointer to the slice’s buffer. The caller must ensure the slice outlives the pointer. ### Response #### Success Response (200) - ***const T** - A raw pointer to the start of the slice. ``` -------------------------------- ### Implement Clone for ImageFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ImageFormat.html Provides methods to create a duplicate of an ImageFormat value or perform copy-assignment. ```rust fn clone(&self) -> ImageFormat ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### as_simd Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into a prefix, a middle of aligned SIMD types, and a suffix. ```APIDOC ## as_simd ### Description A safe wrapper around slice::align_to for SIMD types. This is a nightly-only experimental API. ### Parameters - **LANES** (usize) - Required - The number of lanes for the SIMD type. ### Response - **(&[T], &[Simd], &[T])** - A tuple containing the prefix, the aligned SIMD middle slice, and the suffix. ``` -------------------------------- ### LensInfo Trait Implementations Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.LensInfo.html Overview of the trait implementations available for the LensInfo struct. ```APIDOC ### Trait Implementations for LensInfo #### impl Clone for LensInfo - `fn clone(&self) -> LensInfo`: Returns a duplicate of the value. - `fn clone_from(&mut self, source: &Self)`: Performs copy-assignment from `source`. #### impl Debug for LensInfo - `fn fmt(&self, f: &mut Formatter<'_>) -> Result`: Formats the value using the given formatter. #### impl<'de> Deserialize<'de> for LensInfo - `fn deserialize<__D>(__deserializer: __D) -> Result`: Deserialize this value from the given Serde deserializer. #### impl<'a> From<&'a libraw_lensinfo_t> for LensInfo - `fn from(data: &'a libraw_lensinfo_t) -> Self`: Converts to this type from the input type. #### impl PartialEq for LensInfo - `fn eq(&self, other: &LensInfo) -> bool`: Tests for `self` and `other` values to be equal. - `fn ne(&self, other: &Rhs) -> bool`: Tests for `!=`. #### impl Serialize for LensInfo - `fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>`: Serialize this value into the given Serde serializer. ``` -------------------------------- ### rsplitn Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator over subslices separated by elements that match a predicate, limited to n items, starting from the end. ```APIDOC ## rsplitn(n: usize, pred: F) ### Description Returns an iterator over subslices separated by elements that match `pred` limited to returning at most `n` items. This starts at the end of the slice and works backwards. The matched element is not contained in the subslices. The last element returned, if any, will contain the remainder of the slice. ### Parameters - **n** (usize) - Required - The maximum number of items to return. - **pred** (FnMut(&T) -> bool) - Required - The predicate function to determine split points. ### Response - **RSplitN<'_, T, F>** - An iterator over the subslices. ``` -------------------------------- ### Implement Copy for ThumbFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Indicates that ThumbFormat values can be copied implicitly. This means assignments create a new, independent copy. ```rust impl Copy for ThumbFormat ``` -------------------------------- ### Compare GpsInfo for Equality Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.GpsInfo.html Tests if two GpsInfo values are equal. ```rust fn eq(&self, other: &GpsInfo) -> bool ``` -------------------------------- ### Iterate over chunks from the end with rchunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator over chunks of a specified size starting from the end. Panics if chunk_size is zero. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let mut iter = slice.rchunks(2); assert_eq!(iter.next().unwrap(), &['e', 'm']); assert_eq!(iter.next().unwrap(), &['o', 'r']); assert_eq!(iter.next().unwrap(), &['l']); assert!(iter.next().is_none()); ``` -------------------------------- ### Implement PartialEq for ThumbFormat Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Enables comparing two ThumbFormat values for equality. This is used by the `==` operator. ```rust fn eq(&self, other: &ThumbFormat) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement CloneToUninit for Generic Type T Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Nightly-only experimental API for cloning a value into uninitialized memory. Requires the type `T` to implement `Clone`. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Check if Slice is Empty Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns `true` if the slice has a length of 0. Examples show checking non-empty and empty slices. ```rust pub fn is_empty(&self) -> bool ``` -------------------------------- ### Compare GpsInfo for Inequality Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.GpsInfo.html Tests if two GpsInfo values are not equal. ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Element Offset Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Finds the index of an element reference within a slice. Returns None if the element reference does not point to the start of an element. ```APIDOC ## GET /element_offset ### Description Returns the index that an element reference points to. Returns `None` if `element` does not point to the start of an element within the slice. This method is useful for extending slice iterators like `slice::split`. Note that this uses pointer arithmetic and **does not compare elements**. To find the index of an element via comparison, use `.iter().position()` instead. ### Method GET ### Endpoint `/element_offset` ### Parameters #### Query Parameters - **element** (reference to T) - Required - The element reference to find the offset of. ### Response #### Success Response (200) - **Option** - The index of the element if found, otherwise None. #### Response Example ```json { "offset": 2 } ``` #### Error Response (404) - **None** - If the element is not found within the slice. ##### §Panics Panics if `T` is zero-sized. ``` -------------------------------- ### Modify Slice Elements Using Windows and Cells Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Demonstrates using `Cell::as_slice_of_cells` with `windows` to allow in-place modification of elements within overlapping windows. This is an alternative when `windows_mut` is not directly available due to lifetime constraints. ```rust use std::cell::Cell; let mut array = ['R', 'u', 's', 't', ' ', '2', '0', '1', '5']; let slice = &mut array[..]; let slice_of_cells: &[Cell] = Cell::from_mut(slice).as_slice_of_cells(); for w in slice_of_cells.windows(3) { Cell::swap(&w[0], &w[2]); } assert_eq!(array, ['s', 't', ' ', '2', '0', '1', '5', 'u', 'R']); ``` -------------------------------- ### trim_prefix Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns a subslice with the optional prefix removed. If the slice starts with the prefix, the prefix is removed; otherwise, the original slice is returned. ```APIDOC ## trim_prefix ### Description Returns a subslice with the optional prefix removed. If the slice starts with the prefix, the prefix is removed; otherwise, the original slice is returned. ### Method N/A (This is a method on slices) ### Endpoint N/A ### Parameters N/A ### Request Example ```rust let v = &[10, 40, 30]; assert_eq!(v.trim_prefix(&[10]), &[40, 30][..]); ``` ### Response #### Success Response (Slice) - Returns the subslice after the prefix if it matches. #### Response Example ```rust &[40, 30][..] ``` ``` -------------------------------- ### Implement TryInto for T Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Attempts to convert a value of type `T` into a value of type `U`. This is the reciprocal of `TryFrom` and returns a `Result`. ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Deprecated: Connect Slice Elements with Separator Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html The `connect` method is deprecated and renamed to `join`. It served the same purpose of flattening slices with a separator. ```rust assert_eq!(["hello", "world"].connect(" "), "hello world"); ``` ```rust assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]); ``` -------------------------------- ### Thumbnails API Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.Thumbnails.html Methods for interacting with the Thumbnails struct. ```APIDOC ## Thumbnails Struct ### Description A container for managing a collection of thumbnail images. ### Methods - **new() -> Self**: Creates a new, empty Thumbnails instance. - **append(&mut self, image: ThumbnailImage)**: Adds a new ThumbnailImage to the collection. - **into_inner(self) -> Vec**: Consumes the Thumbnails instance and returns the underlying vector of images. ``` -------------------------------- ### Reverse split slice by predicate Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice starting from the end, working backwards. The matched element is excluded from the resulting subslices. ```rust let slice = [11, 22, 33, 0, 44, 55]; let mut iter = slice.rsplit(|num| *num == 0); assert_eq!(iter.next().unwrap(), &[44, 55]); assert_eq!(iter.next().unwrap(), &[11, 22, 33]); assert_eq!(iter.next(), None); ``` ```rust let v = &[0, 1, 1, 2, 3, 5, 8]; let mut it = v.rsplit(|n| *n % 2 == 0); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next().unwrap(), &[3, 5]); assert_eq!(it.next().unwrap(), &[1, 1]); assert_eq!(it.next().unwrap(), &[]); assert_eq!(it.next(), None); ``` -------------------------------- ### Get raw pointer range of slice Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns a half-open range of raw pointers spanning the slice. Useful for interoperability with foreign interfaces. ```rust let a = [1, 2, 3]; let x = &a[1] as *const _; let y = &5 as *const _; assert!(a.as_ptr_range().contains(&x)); assert!(!a.as_ptr_range().contains(&y)); ``` -------------------------------- ### Split slice into chunks with as_chunks Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into N-element arrays. Panics if N is zero. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let (chunks, remainder) = slice.as_chunks(); assert_eq!(chunks, &[['l', 'o'], ['r', 'e']]); assert_eq!(remainder, &['m']); ``` ```rust let slice = ['R', 'u', 's', 't']; let (chunks, []) = slice.as_chunks::<2>() else { panic!("slice didn't have even length") }; assert_eq!(chunks, &[['R', 'u'], ['s', 't']]); ``` -------------------------------- ### Insert Item into Sorted Vector Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Uses `partition_point` to find the correct insertion index for maintaining sorted order. ```rust let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; let num = 42; let idx = s.partition_point(|&x| x <= num); // If `num` is unique, `s.partition_point(|&x| x < num)` (with `<`) is equivalent to // `s.binary_search(&num).unwrap_or_else(|x| x)`, but using `<=` will allow `insert` // to shift less elements. s.insert(idx, num); assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); ``` -------------------------------- ### Reverse split slice into N parts Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Splits a slice into at most N parts starting from the end. The final part contains the remainder of the slice. ```rust let v = [10, 40, 30, 20, 60, 50]; for group in v.rsplitn(2, |num| *num % 3 == 0) { println!("{group:?}"); } ``` -------------------------------- ### Get last N elements as array Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an array reference to the last N items. Returns None if the slice length is less than N. ```rust let u = [10, 40, 30]; assert_eq!(Some(&[40, 30]), u.last_chunk::<2>()); let v: &[i32] = &[10]; assert_eq!(None, v.last_chunk::<2>()); let w: &[i32] = &[]; assert_eq!(Some(&[]), w.last_chunk::<0>()); ``` -------------------------------- ### Windows Iterator Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Provides an iterator over all contiguous windows of a specified size. Windows overlap. If the slice is shorter than the specified size, no values are returned. Panics if the size is zero. ```APIDOC ## pub fn windows(&self, size: usize) -> Windows<'_, T> ### Description Returns an iterator over all contiguous windows of length `size`. The windows overlap. If the slice is shorter than `size`, the iterator returns no values. ### Method `GET` (conceptual, as this is a method on a slice) ### Endpoint N/A (method on slice) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let mut iter = slice.windows(3); assert_eq!(iter.next().unwrap(), &['l', 'o', 'r']); assert_eq!(iter.next().unwrap(), &['o', 'r', 'e']); assert_eq!(iter.next().unwrap(), &['r', 'e', 'm']); assert!(iter.next().is_none()); ``` ### Response #### Success Response (200) An iterator yielding slices representing the windows. #### Response Example ```rust // Example output from iterator // ['l', 'o', 'r'] // ['o', 'r', 'e'] // ['r', 'e', 'm'] ``` ### Panics Panics if `size` is zero. ``` -------------------------------- ### Escape ASCII Characters Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns an iterator that produces an escaped version of this slice, treating it as an ASCII string. The example shows how to convert the iterator to a string. ```rust pub fn escape_ascii(&self) -> EscapeAscii<'_> ``` -------------------------------- ### Blanket Implementations for RawImage Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.RawImage.html Details on blanket trait implementations that apply to RawImage. ```APIDOC ## Blanket Implementations ### `impl Any for T where T: 'static + ?Sized` #### `fn type_id(&self) -> TypeId` Gets the `TypeId` of `self`. - **Method**: `type_id` - **Returns**: `TypeId` ### `impl Borrow for T where T: ?Sized` #### `fn borrow(&self) -> &T` Immutably borrows from an owned value. - **Method**: `borrow` - **Returns**: `&T` ### `impl BorrowMut for T where T: ?Sized` #### `fn borrow_mut(&mut self) -> &mut T` Mutably borrows from an owned value. - **Method**: `borrow_mut` - **Returns**: `&mut T` ### `impl From for T` #### `fn from(t: T) -> T` Returns the argument unchanged. - **Method**: `from` - **Parameters**: - `t` (*T*) - The value to convert. - **Returns**: `T` ### `impl Into for T where U: From` #### `fn into(self) -> U` Calls `U::from(self)`. This conversion is whatever the implementation of `From for U` chooses to do. - **Method**: `into` - **Returns**: `U` ### `impl TryFrom for T where U: Into` #### `type Error = Infallible` #### `fn try_from(value: U) -> Result>::Error>` Performs the conversion. - **Method**: `try_from` - **Parameters**: - `value` (*U*) - The value to convert. - **Returns**: `Result` ### `impl TryInto for T where U: TryFrom` #### `type Error = >::Error` #### `fn try_into(self) -> Result>::Error>` Performs the conversion. - **Method**: `try_into` - **Returns**: `Result>::Error>` ``` -------------------------------- ### Implement TryFrom for T Source: https://docs.rs/rsraw/0.1.1/rsraw/enum.ThumbFormat.html Attempts to convert a value of type `U` into a value of type `T`. Returns a `Result` to handle potential conversion errors. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### ThumbnailImage Struct Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ThumbnailImage.html Definition and fields for the ThumbnailImage data structure. ```APIDOC ## ThumbnailImage Struct ### Description Represents a thumbnail image with its associated metadata and raw data. ### Fields - **format** (ThumbFormat) - The format of the thumbnail image. - **width** (u32) - The width of the image in pixels. - **height** (u32) - The height of the image in pixels. - **colors** (u16) - The color depth or number of colors. - **data** (Vec) - The raw byte data of the image. ``` -------------------------------- ### Serialize GpsInfo with Serde Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.GpsInfo.html Serializes the GpsInfo value into a Serde serializer. ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, ``` -------------------------------- ### Get raw pointer to slice buffer Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Returns a raw pointer to the slice's buffer. The caller must ensure the slice outlives the pointer and that the memory is not mutated via this pointer. ```rust let x = &[1, 2, 4]; let x_ptr = x.as_ptr(); unsafe { for i in 0..x.len() { assert_eq!(x.get_unchecked(i), &*x_ptr.add(i)); } } ``` -------------------------------- ### DeserializeOwned Trait and try_into Method Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.GpsInfo.html Documentation for the `DeserializeOwned` trait and its `try_into` method. ```APIDOC ## `DeserializeOwned` Trait ### Description The `DeserializeOwned` trait is a marker trait that indicates a type can be deserialized into an owned value. This is useful when you need to deserialize data into a type that does not require borrowing from the input data. ### Associated Function: `try_into` #### Signature ```rust fn try_into(self) -> Result>::Error> ``` #### Description Performs the conversion from a deserialized value into an owned type `U` that implements `TryFrom`. #### Type Parameters - `T`: The type of the deserialized value. - `U`: The target owned type to convert into. #### Return Value A `Result` which is either: - `Ok(U)`: If the conversion is successful, containing the owned value. - `Err(>::Error)`: If the conversion fails, containing the error. ### Example Usage (Conceptual) ```rust // Assuming `data` is a deserialized value and `MyOwnedType` implements `TryFrom` let owned_value: MyOwnedType = data.try_into().expect("Failed to convert to owned type"); ``` ### Implementation Context ```rust impl DeserializeOwned for T where T: for<'de> Deserialize<'de>, { // ... implementation details ... } ``` This implementation block indicates that any type `T` which implements `Deserialize<'de>` for all lifetimes `'de` also implicitly implements `DeserializeOwned`. ``` -------------------------------- ### Binary search by key Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Performs a binary search on a sorted slice using a key extraction function. ```rust let s = [(0, 0), (2, 1), (4, 1), (5, 1), (3, 1), (1, 2), (2, 3), (4, 5), (5, 8), (3, 13), (1, 21), (2, 34), (4, 55)]; assert_eq!(s.binary_search_by_key(&13, |&(a, b)| b), Ok(9)); assert_eq!(s.binary_search_by_key(&4, |&(a, b)| b), Err(7)); assert_eq!(s.binary_search_by_key(&100, |&(a, b)| b), Err(13)); let r = s.binary_search_by_key(&1, |&(a, b)| b); assert!(match r { Ok(1..=4) => true, _ => false, }); ``` -------------------------------- ### Iterate Over Exact-Sized Chunks of a Slice Source: https://docs.rs/rsraw/0.1.1/rsraw/struct.ProcessedImage.html Use `chunks_exact` to get an iterator over sub-slices of exactly `chunk_size`. Elements that do not form a full chunk are available via the `remainder` method. Panics if `chunk_size` is zero. ```rust let slice = ['l', 'o', 'r', 'e', 'm']; let mut iter = slice.chunks_exact(2); assert_eq!(iter.next().unwrap(), &['l', 'o']); assert_eq!(iter.next().unwrap(), &['r', 'e']); assert!(iter.next().is_none()); assert_eq!(iter.remainder(), &['m']); ```