### ReadStorage Trait Documentation Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=u32+-%3E+bool Documentation for the `ReadStorage` trait, which defines the interface for read-only storage devices. It includes methods for reading data and getting the storage capacity. ```APIDOC ## Trait: ReadStorage ### Description Transparent read-only storage trait. ### Associated Types #### type Error An enumeration of storage errors. ### Methods #### fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading `bytes.len()` bytes. This should throw an error in case `bytes.len()` will be larger than `self.capacity() - offset`. #### fn capacity(&self) -> usize The capacity of the storage peripheral in bytes. ### Implementors - `RmwMultiwriteNorFlashStorage<'a, S>` where `S: ReadNorFlash` - `type Error = ::Error` - `RmwNorFlashStorage<'a, S>` where `S: ReadNorFlash` - `type Error = ::Error` ``` -------------------------------- ### RmwNorFlashStorage - ReadStorage Trait Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwNorFlashStorage_search=u32+-%3E+bool Provides methods for reading data from and getting the capacity of the storage. ```APIDOC ## RmwNorFlashStorage - ReadStorage Trait ### Description Implementations for the `ReadStorage` trait, allowing reading data and querying capacity. ### Method GET / POST ### Endpoint `/RmwNorFlashStorage/read` `/RmwNorFlashStorage/capacity` ### Parameters #### Path Parameters - **self** (RmwNorFlashStorage) - Required - The RmwNorFlashStorage instance. #### Query Parameters (for read) - **offset** (u32) - Required - The starting offset for the read operation. - **bytes** (&mut [u8]) - Required - A mutable slice to store the read data. ### Request Example (read) ```json { "offset": 0, "bytes": "" } ``` ### Response #### Success Response (200) for read - **Result<(), Self::Error>** - Ok(()) if read is successful, or an error. #### Success Response (200) for capacity - **usize** - The total capacity of the storage in bytes. #### Response Example (read) ```json { "result": "Ok(())" } ``` #### Response Example (capacity) ```json { "capacity": 1024 } ``` ``` -------------------------------- ### Read Data from Storage Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwMultiwriteNorFlashStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the `read` method for RmwMultiwriteNorFlashStorage, allowing reading a slice of data from the storage peripheral. The read operation starts at a specified `offset` and reads a given number of `bytes`. This implementation requires the underlying `NorFlash` to implement the `ReadNorFlash` trait. ```rust fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> ``` -------------------------------- ### Blanket Implementations Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool Details on blanket implementations available for generic types. ```APIDOC ## Blanket Implementations ### Description This section covers blanket implementations that apply to various types, providing common functionalities. ### `impl Any for T` - **Description**: Provides the `type_id` method to get the `TypeId` of `self`. - **Constraints**: `T: 'static + ?Sized` ### `impl Borrow for T` - **Description**: Provides the `borrow` method for immutable borrowing. - **Constraints**: `T: ?Sized` ### `impl BorrowMut for T` - **Description**: Provides the `borrow_mut` method for mutable borrowing. - **Constraints**: `T: ?Sized` ### `impl From for T` - **Description**: Provides the `from` method, which returns the argument unchanged. ### `impl Into for T` - **Description**: Provides the `into` method, which converts `self` into `U` using `U::from(self)`. - **Constraints**: `U: From` ### `impl IntoIterator for I` - **Description**: Allows types that implement `Iterator` to be converted into an iterator themselves. - **Associated Types**: `Item = ::Item`, `IntoIter = I` - **Method**: `into_iter(self) -> I` ### `impl TryFrom for T` - **Description**: Provides the `try_from` method for fallible conversions. - **Associated Type**: `Error = Infallible` - **Constraints**: `U: Into` ### `impl TryInto for T` - **Description**: Provides the `try_into` method for fallible conversions. - **Associated Type**: `Error = >::Error` - **Constraints**: `U: TryFrom` ``` -------------------------------- ### Get Storage Capacity Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwMultiwriteNorFlashStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the `capacity` method for RmwMultiwriteNorFlashStorage, returning the total storage capacity in bytes. This method is part of the `ReadStorage` trait implementation. ```rust fn capacity(&self) -> usize ``` -------------------------------- ### Storage Implementations Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.Storage_search= Documentation for types that implement the Storage trait. ```APIDOC ## Implementors of Storage Trait ### `RmwMultiwriteNorFlashStorage<'a, S>` #### Description Implementation of the `Storage` trait for `RmwMultiwriteNorFlashStorage`. #### Constraints - `S: MultiwriteNorFlash` ### `RmwNorFlashStorage<'a, S>` #### Description Implementation of the `Storage` trait for `RmwNorFlashStorage`. #### Constraints - `S: NorFlash` ``` -------------------------------- ### Instantiate RmwMultiwriteNorFlashStorage (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwMultiwriteNorFlashStorage Provides a constructor function `new` to create an instance of RmwMultiwriteNorFlashStorage. It takes a NOR flash peripheral and a mutable merge buffer. Panics if the merge buffer is smaller than the flash erase size. ```rust pub fn new(nor_flash: S, merge_buffer: &'a mut [u8]) -> Self ``` -------------------------------- ### ReadStorage Trait Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E The ReadStorage trait defines an interface for read-only storage peripherals. It includes methods to read data at a specific offset and to get the total capacity of the storage. ```APIDOC ## Trait ReadStorage ### Description Transparent read only storage trait. ### Associated Types #### type Error An enumeration of storage errors. ### Methods #### fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading `bytes.len()` bytes. This should throw an error in case `bytes.len()` will be larger than `self.capacity() - offset`. #### fn capacity(&self) -> usize The capacity of the storage peripheral in bytes. ``` -------------------------------- ### RmwNorFlashStorage API Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwNorFlashStorage Documentation for the RmwNorFlashStorage struct, including its constructor and implementations for ReadStorage and Storage traits. ```APIDOC ## Struct RmwNorFlashStorage `embedded_storage::nor_flash::RmwNorFlashStorage` is a generic struct that provides a `Storage` interface over a `NorFlash` peripheral. ### Constructor #### `pub fn new(nor_flash: S, merge_buffer: &'a mut [u8]) -> Self` Instantiates a new generic `Storage` from a `NorFlash` peripheral and a merge buffer. **NOTE**: This function will panic if the provided merge buffer is smaller than the erase size of the flash peripheral. ### Implementations #### `impl<'a, S> ReadStorage for RmwNorFlashStorage<'a, S>` Provides read capabilities for `RmwNorFlashStorage` when the underlying `NorFlash` implements `ReadNorFlash`. - **`type Error = ::Error`**: The error type associated with storage operations. - **`fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>`**: Reads a slice of data from the storage peripheral. - **`fn capacity(&self) -> usize`**: Returns the total capacity of the storage peripheral in bytes. #### `impl<'a, S> Storage for RmwNorFlashStorage<'a, S>` Provides write capabilities for `RmwNorFlashStorage` when the underlying `NorFlash` implements `NorFlash`. - **`fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>`**: Writes a slice of data to the storage peripheral. ``` -------------------------------- ### Implement Iterator Trait for OverlapIterator in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the standard Iterator trait for the OverlapIterator struct. This provides core iteration functionality, including methods to get the next item, estimate remaining elements, and consume the iterator. ```Rust impl<'a, R, I> Iterator for OverlapIterator<'a, R, I> where R: Region, I: Iterator, { type Item = (&'a [u8], R, u32); fn next(&mut self) -> Option { // ... implementation ... } fn size_hint(&self) -> (usize, Option) { // ... implementation ... } // Other Iterator methods like count, last, nth, etc. } ``` -------------------------------- ### RmwNorFlashStorage - Constructor Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwNorFlashStorage_search=u32+-%3E+bool Instantiates a new generic Storage from a NorFlash peripheral. Panics if the merge buffer is smaller than the erase size of the flash peripheral. ```APIDOC ## POST /RmwNorFlashStorage/new ### Description Instantiates a new generic `Storage` from a `NorFlash` peripheral. **NOTE:** This will panic if the provided merge buffer is smaller than the erase size of the flash peripheral. ### Method POST ### Endpoint `/RmwNorFlashStorage/new` ### Parameters #### Query Parameters - **nor_flash** (S) - Required - The NorFlash peripheral to use. - **merge_buffer** (&'a mut [u8]) - Required - A mutable slice representing the merge buffer. ### Request Body ```json { "nor_flash": "", "merge_buffer": "" } ``` ### Response #### Success Response (200) - **Self** (RmwNorFlashStorage) - The newly created RmwNorFlashStorage instance. #### Response Example ```json { "instance": "" } ``` ``` -------------------------------- ### Module iter Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/index_search=std%3A%3Avec Documentation for the 'iter' module within the embedded-storage crate. ```APIDOC ## Module iter ### Description This module currently contains the `OverlapIterator` struct. ### Structs #### OverlapIterator - **Description**: An iterator that produces block-region pairs, where each memory block maps to each region. ### Traits #### IterableByOverlaps - **Description**: A trait that allows adding an `overlaps` function to all iterators over `Region`. ``` -------------------------------- ### ReadStorage::read Method (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the `read` method for the `ReadStorage` trait. This method reads a specified number of bytes from the storage peripheral starting at a given offset. It returns a `Result` indicating success or a storage-specific error. ```Rust fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>; ``` -------------------------------- ### Skip Elements in an Iterator (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator The `skip` method creates a new iterator that discards the first `n` elements from the original iterator. This is useful for paginating or processing data starting from a specific offset. It requires the iterator to be `Sized` and returns a `Skip` iterator. ```rust fn skip(self, n: usize) -> Skip where Self: Sized ``` -------------------------------- ### Implement Any trait for generic types in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwMultiwriteNorFlashStorage_search=std%3A%3Avec Demonstrates the blanket implementation of the `Any` trait for any type `T` that is `'static` and sized. This allows for runtime type identification. ```rust impl Any for T where T: 'static + ?Sized, { fn type_id(&self) -> TypeId; } ``` -------------------------------- ### ReadStorage Trait Read Method in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=std%3A%3Avec Implements the `read` method for the `ReadStorage` trait. This method reads a specified number of bytes from the storage peripheral starting at a given offset. It returns a `Result` to indicate success or failure, with `Self::Error` detailing any issues. ```rust fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>; // Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading `bytes.len()` bytes. // This should throw an error in case `bytes.len()` will be larger than `self.capacity() - offset`. ``` -------------------------------- ### Borrowing Functionality Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides methods for borrowing data immutably (`borrow`) and mutably (`borrow_mut`). These are fundamental for accessing data without taking ownership, implemented for types that support borrowing. ```rust fn borrow(&self) -> &T fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### TryFrom and TryInto Conversion Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides fallible conversion methods between types. `TryFrom` attempts conversion and returns a `Result`, while `TryInto` is the inverse. The `Error` type is `Infallible` for direct conversions. ```rust type Error = Infallible fn try_from(value: U) -> Result>::Error> type Error = >::Error fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Embedded Storage Traits Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/embedded-storage This section details the core traits provided by the embedded-storage crate for interacting with storage devices. ```APIDOC ## Traits ### ReadStorage #### Description Transparent read-only storage trait. ### Method (Not applicable, this is a trait definition) ### Endpoint (Not applicable, this is a trait definition) ### Parameters (Not applicable, this is a trait definition) ### Request Example (Not applicable, this is a trait definition) ### Response #### Success Response (200) (Not applicable, this is a trait definition) #### Response Example (Not applicable, this is a trait definition) --- ### Region #### Description A region denotes a contiguous piece of memory between two addresses. ### Method (Not applicable, this is a trait definition) ### Endpoint (Not applicable, this is a trait definition) ### Parameters (Not applicable, this is a trait definition) ### Request Example (Not applicable, this is a trait definition) ### Response #### Success Response (200) (Not applicable, this is a trait definition) #### Response Example (Not applicable, this is a trait definition) --- ### Storage #### Description Transparent read/write storage trait. ### Method (Not applicable, this is a trait definition) ### Endpoint (Not applicable, this is a trait definition) ### Parameters (Not applicable, this is a trait definition) ### Request Example (Not applicable, this is a trait definition) ### Response #### Success Response (200) (Not applicable, this is a trait definition) #### Response Example (Not applicable, this is a trait definition) ``` -------------------------------- ### TryInto Conversion Method Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/enum.NorFlashErrorKind_search=u32+-%3E+bool The `try_into` method attempts a conversion that might fail. It returns a `Result` containing the converted value or an error if the conversion is not possible. ```Rust ### impl TryInto for T where U: TryFrom, #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Auto Trait Implementations Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool Information about automatically implemented traits for `OverlapIterator`. ```APIDOC ## Auto Trait Implementations for OverlapIterator<'a, R, I> ### Description This section details the auto-trait implementations for the `OverlapIterator` struct, indicating its thread-safety and memory safety characteristics. ### Implemented Traits - **`Freeze`**: Requires `I: Freeze`. - **`RefUnwindSafe`**: Requires `I: RefUnwindSafe`. - **`Send`**: Requires `I: Send`. - **`Sync`**: Requires `I: Sync`. - **`Unpin`**: Requires `I: Unpin`. - **`UnwindSafe`**: Requires `I: UnwindSafe`. ``` -------------------------------- ### Iterator Comparison APIs Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator Provides methods for lexicographical comparison and equality checks between iterators. ```APIDOC ## Iterator Comparison APIs ### `partial_cmp_by` #### Description Lexicographically compares the elements of this `Iterator` with those of another with respect to the specified comparison function. This is a nightly-only experimental API. #### Method `partial_cmp_by` #### Parameters - `other` (I): An iterator to compare against. - `partial_cmp` (F): A closure that takes two elements and returns an `Option`. #### Returns `Option`: The comparison result. ### `eq` #### Description Determines if the elements of this `Iterator` are equal to those of another. #### Method `eq` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterators are equal, `false` otherwise. ### `eq_by` #### Description Determines if the elements of this `Iterator` are equal to those of another with respect to the specified equality function. This is a nightly-only experimental API. #### Method `eq_by` #### Parameters - `other` (I): An iterator to compare against. - `eq` (F): A closure that takes two elements and returns a `bool` indicating equality. #### Returns `bool`: `true` if the iterators are equal according to the function, `false` otherwise. ### `ne` #### Description Determines if the elements of this `Iterator` are not equal to those of another. #### Method `ne` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterators are not equal, `false` otherwise. ### `lt` #### Description Determines if the elements of this `Iterator` are lexicographically less than those of another. #### Method `lt` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterator is lexicographically less than the other, `false` otherwise. ### `le` #### Description Determines if the elements of this `Iterator` are lexicographically less or equal to those of another. #### Method `le` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterator is lexicographically less than or equal to the other, `false` otherwise. ### `gt` #### Description Determines if the elements of this `Iterator` are lexicographically greater than those of another. #### Method `gt` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterator is lexicographically greater than the other, `false` otherwise. ### `ge` #### Description Determines if the elements of this `Iterator` are lexicographically greater than or equal to those of another. #### Method `ge` #### Parameters - `other` (I): An iterator to compare against. #### Returns `bool`: `true` if the iterator is lexicographically greater than or equal to the other, `false` otherwise. ``` -------------------------------- ### Experimental Equality Check Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search= An experimental method to determine if elements are equal using a custom equality function. ```APIDOC ## GET /iterator/eq_by ### Description Determines if the elements of this `Iterator` are equal to those of another with respect to the specified equality function. This is a nightly-only experimental API. ### Method GET ### Endpoint /iterator/eq_by ### Parameters #### Query Parameters - **other** (Iterator) - Required - The other iterator to compare against. - **eq** (function) - Required - The equality function to use for comparison. ### Response #### Success Response (200) - **result** (bool) - True if the elements are equal according to the provided function, false otherwise. #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### TryFrom and TryInto Conversions (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool These blanket implementations provide `TryFrom` and `TryInto` for types where a conversion is possible via `Into`. They allow for fallible conversions, returning a `Result` to handle potential errors, though the `Error` type is `Infallible` in this specific blanket implementation. ```rust type Error = Infallible fn try_from(value: U) -> Result>::Error> { // Implementation details... } fn try_into(self) -> Result>::Error> { // Implementation details... } ``` -------------------------------- ### Identity Conversion Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements `From` for `T` and `Into` for `T` where `U` is `T`. The `from` function simply returns the input value, signifying an identity conversion. ```rust fn from(t: T) -> T fn into(self) -> U where U: From, ``` -------------------------------- ### NOR Flash Structs Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/index_search= Documentation for the structs used to represent NOR flash storage, including those supporting read-modify-write operations. ```APIDOC ## Structs ### `RmwMultiwriteNorFlashStorage` **Description**: Represents a NOR flash storage device that supports read-modify-write and multi-write operations. ### `RmwNorFlashStorage` **Description**: Represents a NOR flash storage device that supports read-modify-write operations. ``` -------------------------------- ### Custom Equality Comparison for Iterators (Rust - Nightly) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search= This nightly-only experimental API allows comparing iterator elements using a custom equality function. It provides flexibility beyond the standard `PartialEq` implementation. ```rust fn eq_by(self, other: I, eq: F) -> bool where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> bool, Determines if the elements of this `Iterator` are equal to those of another with respect to the specified equality function. ``` -------------------------------- ### Borrowing Operations (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool These implementations provide methods for borrowing data immutably (`borrow`) and mutably (`borrow_mut`). They are fundamental for accessing data without taking ownership. ```rust fn borrow(&self) -> &T where T: ?Sized, { // Implementation details... } fn borrow_mut(&mut self) -> &mut T where T: ?Sized, { // Implementation details... } ``` -------------------------------- ### Rust: Implement TryInto for T Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/enum.NorFlashErrorKind_search=std%3A%3Avec Explains the `TryInto for T` trait, which provides a convenient way to perform fallible conversions. It relies on the `TryFrom for U` trait and defines an `Error` type that mirrors the underlying `TryFrom` error. ```rust impl TryInto for T where U: TryFrom, { type Error = >::Error; fn try_into(self) -> Result { U::try_from(self) } } ``` -------------------------------- ### Iterator Reference and State Methods Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator Methods related to accessing iterators by reference or managing their state. ```APIDOC ## Iterator Reference and State Methods ### Description Methods for interacting with iterator state and references. ### Methods #### `by_ref(&mut self)` - **Description**: Creates a "by reference" adapter for the iterator instance. - **Version**: 1.0.0 ``` -------------------------------- ### Rust: Implement Into for T Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/enum.NorFlashErrorKind_search=std%3A%3Avec Demonstrates the `into` method, which calls `U::from(self)`. This conversion's behavior is determined by the `From for U` trait implementation. It's a common pattern for owned value conversions. ```rust impl Into for T where U: From, { fn into(self) -> U { U::from(self) } } ``` -------------------------------- ### Partial Compare Iterators with Function (Rust - Nightly) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool An experimental nightly-only API that lexicographically compares two iterators using a provided partial comparison function. This allows for custom partial ordering logic. ```rust fn partial_cmp_by(self, other: I, partial_cmp: F) -> Option where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> Option, ``` -------------------------------- ### TryFrom Conversion Method Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/enum.NorFlashErrorKind_search=u32+-%3E+bool The `try_from` method attempts to create a value of type `T` from a value of type `U`. It returns a `Result` indicating success or failure. ```Rust ### impl TryFrom for T where U: Into, #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### ReadNorFlash Trait Documentation Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/trait.ReadNorFlash_search= Documentation for the ReadNorFlash trait, which defines methods for reading data from NOR flash memory. ```APIDOC ## Trait ReadNorFlash ### Description Read only NOR flash trait. ### Associated Constants #### const READ_SIZE: usize * **Description**: The minimum number of bytes the storage peripheral can read. * **Type**: `usize` ### Methods #### fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error> * **Description**: Reads a slice of data from the storage peripheral, starting at the given offset and reading `bytes.len()` bytes. * **Parameters**: * `offset` (u32) - The starting address offset for the read operation. * `bytes` (&mut [u8]) - A mutable byte slice to store the read data. * **Returns**: `Result<(), Self::Error>` - Ok(()) on success, or an error if the arguments are not aligned or out of bounds. #### fn capacity(&self) -> usize * **Description**: Returns the total capacity of the peripheral in bytes. * **Type**: `usize` ### Dyn Compatibility This trait is **not** dyn compatible. ``` -------------------------------- ### Map Over Sliding Windows (Rust - Nightly) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Calls a function `f` for each contiguous window of size `N` over the iterator's elements. Returns an iterator over the results of `f`. Windows overlap. This is a nightly-only experimental API. Requires `Self: Sized`. ```rust fn map_windows(self, f: F) -> MapWindows where Self: Sized, F: FnMut(&[Self::Item; N]) -> R ``` -------------------------------- ### Iterator Collection and Folding Methods Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator Methods for consuming iterators to produce collections, perform reductions, or test conditions on all elements. ```APIDOC ## Iterator Collection and Folding Methods ### Description These methods consume iterators to produce collections, perform reductions, or test conditions. ### Methods #### `collect()` - **Description**: Transforms an iterator into a collection. - **Version**: N/A (Source available) #### `try_collect()` - **Description**: Fallibly transforms an iterator into a collection, short-circuiting if a failure is encountered. - **Note**: This is a nightly-only experimental API. - **Version**: N/A (Source available) #### `collect_into(collection: &mut E)` - **Description**: Collects all items from an iterator into a mutable collection. - **Note**: This is a nightly-only experimental API. - **Version**: 1.0.0 #### `partition(f: F)` - **Description**: Consumes an iterator, creating two collections based on a predicate. - **Version**: N/A (Source available) #### `is_partitioned

(predicate: P)` - **Description**: Checks if the elements of the iterator are partitioned according to a predicate. - **Note**: This is a nightly-only experimental API. - **Version**: 1.27.0 #### `try_fold(init: B, f: F)` - **Description**: Applies a fallible function to elements, accumulating a result until failure or completion. - **Version**: 1.27.0 #### `try_for_each(f: F)` - **Description**: Applies a fallible function to each item, stopping at the first error. - **Version**: 1.0.0 #### `fold(init: B, f: F)` - **Description**: Folds every element into an accumulator by applying an operation, returning the final result. - **Version**: 1.51.0 #### `reduce(f: F)` - **Description**: Reduces the elements to a single one by repeatedly applying a reducing operation. - **Version**: N/A (Source available) #### `try_reduce(f: impl FnMut(Self::Item, Self::Item) -> R)` - **Description**: Reduces elements to a single one, propagating failures from the closure. - **Note**: This is a nightly-only experimental API. - **Version**: 1.0.0 #### `all(f: F)` - **Description**: Tests if every element of the iterator matches a predicate. - **Version**: 1.0.0 ``` -------------------------------- ### RmwNorFlashStorage Implementation Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implementation of the ReadStorage trait for RmwNorFlashStorage. ```APIDOC ## impl<'a, S> ReadStorage for RmwNorFlashStorage<'a, S> ### Description Implementation of the ReadStorage trait for RmwNorFlashStorage. ### Associated Types #### type Error = ::Error ### Methods (Inherited from ReadStorage trait) ``` -------------------------------- ### MultiwriteNorFlash Trait Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/trait.MultiwriteNorFlash_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Documentation for the MultiwriteNorFlash trait, which extends NorFlash and allows writes to the same word twice, resulting in a logical AND operation. It also specifies behavior during power loss. ```APIDOC ## Trait MultiwriteNorFlash ### Description Marker trait for NorFlash relaxing the restrictions on `write`. Writes to the same word twice are now allowed. The result is the logical AND of the previous data and the written data. That is, it is only possible to change 1 bits to 0 bits. If power is lost during write: * Bits that were 1 on flash and are written to 1 are guaranteed to stay as 1 * Bits that were 1 on flash and are written to 0 are undefined * Bits that were 0 on flash are guaranteed to stay as 0 * Rest of the bits in the page are guaranteed to be unchanged ### Method Trait definition ### Endpoint embedded_storage::nor_flash ### Parameters This is a trait definition and does not have direct parameters in the context of an API endpoint. ### Request Example N/A ### Response N/A ## Dyn Compatibility This trait is **not** dyn compatible. In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe. ``` -------------------------------- ### RmwNorFlashStorage - Storage Trait Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwNorFlashStorage_search=u32+-%3E+bool Provides methods for writing data to the storage. ```APIDOC ## RmwNorFlashStorage - Storage Trait ### Description Implementation for the `Storage` trait, allowing writing data to the storage. ### Method POST ### Endpoint `/RmwNorFlashStorage/write` ### Parameters #### Path Parameters - **self** (RmwNorFlashStorage) - Required - The RmwNorFlashStorage instance. #### Query Parameters - **offset** (u32) - Required - The starting offset for the write operation. - **bytes** (&[u8]) - Required - The data to write. ### Request Body ```json { "offset": 0, "bytes": "" } ``` ### Response #### Success Response (200) - **Result<(), Self::Error>** - Ok(()) if write is successful, or an error. #### Response Example ```json { "result": "Ok(())" } ``` ``` -------------------------------- ### Create By-Reference Iterator Adapter (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a "by reference" adapter for an iterator instance. This allows borrowing the iterator's state without consuming the original iterator. Requires `Self: Sized`. ```rust fn by_ref(&mut self) -> &mut Self where Self: Sized ``` -------------------------------- ### Iterator Aggregation and Comparison Methods Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool Methods for calculating aggregate values from an iterator or comparing iterators. ```APIDOC ## GET /iterator/sum ### Description Sums the elements of an iterator. ### Method GET ### Endpoint `/iterator/sum` ### Response #### Success Response (200) - **sum_value** (S) - The sum of the elements in the iterator. #### Response Example ```json { "sum_value": 100 } ``` ## GET /iterator/product ### Description Iterates over the entire iterator, multiplying all the elements. ### Method GET ### Endpoint `/iterator/product` ### Response #### Success Response (200) - **product_value** (P) - The product of the elements in the iterator. #### Response Example ```json { "product_value": 120 } ``` ## GET /iterator/cmp ### Description Lexicographically compares the elements of this `Iterator` with those of another. ### Method GET ### Endpoint `/iterator/cmp` ### Parameters #### Query Parameters - **other** (IntoIterator) - Required - The other iterator to compare against. ### Response #### Success Response (200) - **comparison_result** (Ordering) - The result of the comparison (Less, Equal, Greater). #### Response Example ```json { "comparison_result": "Equal" } ``` ## GET /iterator/cmp_by ### Description Lexicographically compares the elements of this `Iterator` with those of another with respect to the specified comparison function. This is a nightly-only experimental API. ### Method GET ### Endpoint `/iterator/cmp_by` ### Parameters #### Query Parameters - **other** (IntoIterator) - Required - The other iterator to compare against. - **cmp** (function) - Required - A function that takes two items and returns an Ordering. ### Response #### Success Response (200) - **comparison_result** (Ordering) - The result of the comparison (Less, Equal, Greater). #### Response Example ```json { "comparison_result": "Less" } ``` ## GET /iterator/partial_cmp ### Description Lexicographically compares the `PartialOrd` elements of this `Iterator` with those of another. The comparison works like short-circuit evaluation. ### Method GET ### Endpoint `/iterator/partial_cmp` ### Parameters #### Query Parameters - **other** (IntoIterator) - Required - The other iterator to compare against. ### Response #### Success Response (200) - **comparison_result** (Option) - The result of the partial comparison, or None if an order cannot be determined. #### Response Example ```json { "comparison_result": "Some(Greater)" } ``` ## GET /iterator/partial_cmp_by ### Description Lexicographically compares the elements of this `Iterator` with those of another with respect to the specified comparison function. This is a nightly-only experimental API. ### Method GET ### Endpoint `/iterator/partial_cmp_by` ### Parameters #### Query Parameters - **other** (IntoIterator) - Required - The other iterator to compare against. - **partial_cmp** (function) - Required - A function that takes two items and returns an Option. ### Response #### Success Response (200) - **comparison_result** (Option) - The result of the partial comparison, or None if an order cannot be determined. #### Response Example ```json { "comparison_result": "Some(Less)" } ``` ``` -------------------------------- ### Iterator Min/Max Methods Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool Methods for finding the minimum or maximum element in an iterator. ```APIDOC ## GET /iterator/max ### Description Returns the maximum element of an iterator. ### Method GET ### Endpoint `/iterator/max` ### Response #### Success Response (200) - **max_element** (Option) - The maximum element in the iterator, or None if the iterator is empty. #### Response Example ```json { "max_element": "example_max_item" } ``` ## GET /iterator/min ### Description Returns the minimum element of an iterator. ### Method GET ### Endpoint `/iterator/min` ### Response #### Success Response (200) - **min_element** (Option) - The minimum element in the iterator, or None if the iterator is empty. #### Response Example ```json { "min_element": "example_min_item" } ``` ## GET /iterator/max_by_key ### Description Returns the element that gives the maximum value from the specified function. ### Method GET ### Endpoint `/iterator/max_by_key` ### Parameters #### Query Parameters - **f** (function) - Required - A function that takes an item and returns a value of type B, where B implements Ord. ### Response #### Success Response (200) - **max_element** (Option) - The element yielding the maximum value, or None if the iterator is empty. #### Response Example ```json { "max_element": "example_item_with_max_key" } ``` ## GET /iterator/max_by ### Description Returns the element that gives the maximum value with respect to the specified comparison function. ### Method GET ### Endpoint `/iterator/max_by` ### Parameters #### Query Parameters - **compare** (function) - Required - A function that takes two items and returns an Ordering. ### Response #### Success Response (200) - **max_element** (Option) - The element yielding the maximum value according to the comparison function, or None if the iterator is empty. #### Response Example ```json { "max_element": "example_item_based_on_comparison" } ``` ## GET /iterator/min_by_key ### Description Returns the element that gives the minimum value from the specified function. ### Method GET ### Endpoint `/iterator/min_by_key` ### Parameters #### Query Parameters - **f** (function) - Required - A function that takes an item and returns a value of type B, where B implements Ord. ### Response #### Success Response (200) - **min_element** (Option) - The element yielding the minimum value, or None if the iterator is empty. #### Response Example ```json { "min_element": "example_item_with_min_key" } ``` ## GET /iterator/min_by ### Description Returns the element that gives the minimum value with respect to the specified comparison function. ### Method GET ### Endpoint `/iterator/min_by` ### Parameters #### Query Parameters - **compare** (function) - Required - A function that takes two items and returns an Ordering. ### Response #### Success Response (200) - **min_element** (Option) - The element yielding the minimum value according to the comparison function, or None if the iterator is empty. #### Response Example ```json { "min_element": "example_item_based_on_comparison" } ``` ``` -------------------------------- ### Implement Storage Trait for RmwNorFlashStorage (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.Storage_search= Provides an implementation of the `Storage` trait for `RmwNorFlashStorage`. This enables the use of the `Storage` trait's functionality with NOR flash devices that support read-modify-write operations. It ensures compatibility with the broader embedded storage ecosystem. ```Rust impl<'a, S> Storage for RmwNorFlashStorage<'a, S> where S: NorFlash, ``` -------------------------------- ### Implement TryFrom trait for generic types in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/nor_flash/struct.RmwMultiwriteNorFlashStorage_search=std%3A%3Avec Shows the blanket implementation of the `TryFrom` trait for types `T` and `U` where `U` implements `Into`. This allows for fallible type conversions. ```rust impl TryFrom for T where U: Into, { type Error = Infallible; fn try_from(value: U) -> Result>::Error>; } ``` -------------------------------- ### Compare Iterators Lexicographically with Function (Rust - Nightly) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E An experimental nightly-only API that lexicographically compares two iterators using a provided comparison function. This allows for custom comparison logic. ```rust fn cmp_by(self, other: I, cmp: F) -> Ordering where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> Ordering, ``` -------------------------------- ### Iterator Collection and Transformation Methods Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool Methods for transforming iterator items or collecting them into different structures. ```APIDOC ## GET /iterator/unzip ### Description Converts an iterator of pairs into a pair of containers. ### Method GET ### Endpoint `/iterator/unzip` ### Response #### Success Response (200) - **pair_of_containers** (tuple) - A tuple containing two containers, one for each element of the pair. #### Response Example ```json { "pair_of_containers": ["container_a", "container_b"] } ``` ## GET /iterator/copied ### Description Creates an iterator which copies all of its elements. Requires the element type to implement `Copy`. ### Method GET ### Endpoint `/iterator/copied` ### Response #### Success Response (200) - **copied_iterator** (Copied) - An iterator that yields copied elements. #### Response Example ```json { "copied_iterator": "example_iterator_with_copied_items" } ``` ## GET /iterator/cloned ### Description Creates an iterator which `clone`s all of its elements. Requires the element type to implement `Clone`. ### Method GET ### Endpoint `/iterator/cloned` ### Response #### Success Response (200) - **cloned_iterator** (Cloned) - An iterator that yields cloned elements. #### Response Example ```json { "cloned_iterator": "example_iterator_with_cloned_items" } ``` ## GET /iterator/array_chunks ### Description Returns an iterator over `N` elements of the iterator at a time. This is a nightly-only experimental API. ### Method GET ### Endpoint `/iterator/array_chunks` ### Parameters #### Query Parameters - **N** (usize) - Required - The number of elements per chunk. ### Response #### Success Response (200) - **array_chunks_iterator** (ArrayChunks) - An iterator yielding chunks of size N. #### Response Example ```json { "array_chunks_iterator": "example_iterator_of_array_chunks" } ``` ``` -------------------------------- ### Identity Conversion (Rust) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=u32+-%3E+bool The `From for T` implementation provides an identity conversion, meaning the `from` function simply returns the input value unchanged. This is often used as a base case or for completeness. ```rust fn from(t: T) -> T { // Implementation details... } ``` -------------------------------- ### Partial Compare Iterators with Function (Rust - Nightly) Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E An experimental nightly-only API that performs a partial lexicographical comparison of two iterators using a provided partial comparison function. Returns `Some(Ordering)` if comparable, `None` otherwise. ```rust fn partial_cmp_by( self, other: I, partial_cmp: F, ) -> Option where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> Option, ``` -------------------------------- ### RmwMultiwriteNorFlashStorage Implementation Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.ReadStorage_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implementation of the ReadStorage trait for RmwMultiwriteNorFlashStorage. ```APIDOC ## impl<'a, S> ReadStorage for RmwMultiwriteNorFlashStorage<'a, S> ### Description Implementation of the ReadStorage trait for RmwMultiwriteNorFlashStorage. ### Associated Types #### type Error = ::Error ### Methods (Inherited from ReadStorage trait) ``` -------------------------------- ### Implement nightly-only next_chunk for OverlapIterator in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the experimental `next_chunk` method for OverlapIterator, which is available only on nightly Rust builds. This method allows fetching multiple items at once into a fixed-size array. ```Rust fn next_chunk( &mut self, ) -> Result<[Self::Item; N], IntoIter> where Self: Sized, { // ... implementation ... } ``` -------------------------------- ### Implement Storage Trait for RmwMultiwriteNorFlashStorage in Rust Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/trait.Storage An implementation of the `Storage` trait for `RmwMultiwriteNorFlashStorage`. This version is optimized for NOR flash devices that support multi-write capabilities, potentially offering improved write performance. ```rust impl<'a, S> Storage for RmwMultiwriteNorFlashStorage<'a, S> where S: MultiwriteNorFlash, { ``` -------------------------------- ### Create Value From Itself Source: https://docs.rs/embedded-storage/0.3.1/embedded_storage/iter/struct.OverlapIterator_search=std%3A%3Avec Returns the argument unchanged. This is the core implementation of the From for T trait, indicating a trivial conversion. ```Rust fn from(t: T) -> T ```