### From Conversion Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the `from` method, which creates a value of one type from another. ```rust impl From for T { #[inline] fn from(t: T) -> T { t } } ``` -------------------------------- ### CloneToUninit Example (Nightly) Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E An experimental, nightly-only API for performing copy-assignment from a value to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) where T: Clone, { // ... } ``` -------------------------------- ### Into Conversion Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Illustrates the `into` method, which converts a value into another type that implements `From` for the original type. ```rust impl Into for T where U: From, { #[inline] fn into(self) -> U { U::from(self) } } ``` -------------------------------- ### TryInto Conversion Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the `try_into` method, which attempts a conversion from one type to another, returning a `Result`. ```rust impl TryInto for T where U: TryFrom, { type Error = >::Error; #[inline] fn try_into(self) -> Result { U::try_from(self) } } ``` -------------------------------- ### Into Trait Implementation Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Unlimited.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Illustrates the usage of the Into trait for type conversion, which is automatically implemented when a From trait is implemented. ```rust impl Into for T where U: From, { fn into(self) -> U { U::from(self) } } ``` -------------------------------- ### TryFrom Conversion Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows the `try_from` method, which attempts to create a value of one type from another, returning a `Result`. ```rust impl TryFrom for T where U: Into, { type Error = Infallible; #[inline] fn try_from(value: U) -> Result { Ok(value.into()) } } ``` -------------------------------- ### ToOwned and CloneInto Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Shows how to create owned data from borrowed data using `to_owned` (typically by cloning) and how to replace owned data with borrowed data using `clone_into`. ```rust impl ToOwned for T where T: Clone, { type Owned = T; #[inline] fn to_owned(&self) -> T { self.clone() } #[inline] fn clone_into(&self, target: &mut T) { target.clone_from(self) } } ``` -------------------------------- ### TryInto Trait Implementation Example Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Unlimited.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates the usage of the TryInto trait for type conversion, showing how a value can be converted into another type if a TryFrom implementation exists. ```rust impl TryInto for T where U: TryFrom, { type Error = >::Error; #[inline] fn try_into(self) -> Result>::Error> { U::try_from(self) } } ``` -------------------------------- ### enumerate Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search=std%3A%3Avec Creates an iterator that yields pairs of (index, element). The index starts at 0. ```APIDOC ## enumerate(self) -> Enumerate ### Description Creates an iterator which gives the current iteration count as well as the next value. ### Method `enumerate` ``` -------------------------------- ### LruMap::get_or_insert Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Gets a value by key or inserts a new value if the key is not present, promoting the entry if found or inserted. ```APIDOC ## LruMap::get_or_insert ### Description Tries to get the value for a given `key` or insert a new value if there’s no element in the map which matches that `key`. If present the element will be promoted to be the most recently used. ### Method `pub fn get_or_insert<'a>(&mut self, key: impl Into> + Hash + PartialEq + ?Sized, get: impl FnOnce() -> V) -> Option<&mut V>` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Option<&mut V>** - A mutable reference to the value if found or newly inserted, otherwise `None`. ### Response Example None ``` -------------------------------- ### Get or Insert Value Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Tries to get a value by key, or inserts a new value if the key is not present. If an element is found or inserted, it's promoted to most recently used. ```rust pub fn get_or_insert<'a>( &mut self, key: impl Into> + Hash + PartialEq + ?Sized, get: impl FnOnce() -> V, ) -> Option<&mut V> where L::KeyToInsert<'a>: Hash + PartialEq, ``` -------------------------------- ### type_id Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Gets the `TypeId` of the LruMap. ```APIDOC ## type_id ### Description Gets the `TypeId` of `self`. ### Method `type_id` ### Returns - TypeId - The unique identifier for the type of `self`. ``` -------------------------------- ### Get Map Length Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Returns the number of elements currently stored in the map. ```rust pub fn len(&self) -> usize ``` -------------------------------- ### take Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=u32+-%3E+bool Creates an iterator that yields the first `n` elements. ```APIDOC ## fn take(self, n: usize) -> Take ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Parameters * `n` (usize) - The maximum number of elements to yield. ### Returns A `Take` iterator. ``` -------------------------------- ### Any Trait Implementation Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.RandomState.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Implements the Any trait for any type T, providing a method to get the TypeId of the instance. ```rust impl Any for T where T: 'static + ?Sized, ``` ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get Current Memory Usage Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Returns the current memory usage of the map in bytes. ```rust pub fn memory_usage(&self) -> usize ``` -------------------------------- ### Any Trait Implementation for T Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.RandomState.html?search=u32+-%3E+bool Blanket implementation of the Any trait for any type T, providing a method to get the TypeId of the instance. ```rust impl Any for T where T: 'static + ?Sized, { fn type_id(&self) -> TypeId { // ... } } ``` -------------------------------- ### Get Max Length of ByLength Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByLength.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the maximum allowed length configured for the ByLength limiter. ```rust pub const fn max_length(&self) -> u32 ``` -------------------------------- ### take Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search= Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ```APIDOC ## take(self, n: usize) ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### take Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search=std%3A%3Avec Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ```APIDOC ## take(self, n: usize) -> Take ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Method `take` ### Parameters - `n`: The maximum number of elements to yield. ``` -------------------------------- ### Generic Implementation of Any for T Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.RandomState.html?search=std%3A%3Avec A blanket implementation of the Any trait for any type T that is 'static and not ?Sized, providing a method to get the TypeId. ```rust fn type_id(&self) -> TypeId; ``` -------------------------------- ### LruMap Creation Methods Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html?search=std%3A%3Avec Provides methods for creating new LruMap instances with different configurations for limiters and hashers. ```APIDOC ## `new(limiter: L) -> Self` ### Description Creates a new empty map with a given `limiter`. ### Method `new` ### Parameters - `limiter` (L): The limiter to use for the LRU map. ### Returns A new empty `LruMap` instance. ``` ```APIDOC ## `with_seed(limiter: L, seed: [u64; 4]) -> Self` ### Description Creates a new empty map with a given `limiter` and a non-randomized hasher. ### Method `with_seed` ### Parameters - `limiter` (L): The limiter to use for the LRU map. - `seed` ([u64; 4]): The seed for the hasher. ### Returns A new empty `LruMap` instance. ``` ```APIDOC ## `with_memory_budget_and_hasher(memory_budget: usize, hasher: S) -> Self` ### Description Creates a new empty map with a given `memory_budget` and `hasher`. This configures the limiter so that the map can use at most `memory_budget` bytes of memory. This does not preallocate any memory. ### Method `with_memory_budget_and_hasher` ### Parameters - `memory_budget` (usize): The maximum memory budget in bytes. - `hasher` (S): The hasher to use. ### Returns A new empty `LruMap` instance. ``` ```APIDOC ## `with_memory_budget(memory_budget: usize) -> Self` ### Description Creates a new empty map with a given `memory_budget`. This configures the limiter so that the map can use at most `memory_budget` bytes of memory. This does not preallocate any memory. ### Method `with_memory_budget` ### Parameters - `memory_budget` (usize): The maximum memory budget in bytes. ### Returns A new empty `LruMap` instance. ``` ```APIDOC ## `with_hasher(limiter: L, hasher: S) -> Self` ### Description Creates a new map with a given `limiter` and `hasher`. ### Method `with_hasher` ### Parameters - `limiter` (L): The limiter to use for the LRU map. - `hasher` (S): The hasher to use. ### Returns A new `LruMap` instance. ``` -------------------------------- ### Basic LRU Map Usage with Length Limit Source: https://docs.rs/schnellru/0.2.4/schnellru/index.html Demonstrates inserting elements into an LruMap limited by length, accessing elements, and observing the eviction of the least recently accessed item when a new element is added. Shows how element order changes upon access. ```rust use schnellru::{LruMap, ByLength}; let mut map = LruMap::new(ByLength::new(3)); // Insert three elements. map.insert(1, "one"); map.insert(2, "two"); map.insert(3, "three"); assert_eq!(map.len(), 3); // They're ordered according to which one was inserted last. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&3, &"three")); assert_eq!(iter.next().unwrap(), (&2, &"two")); assert_eq!(iter.next().unwrap(), (&1, &"one")); // Access the least recently inserted one. assert_eq!(*map.get(&1).unwrap(), "one"); // Now the order's changed. // The element we've accessed was moved to the front. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&1, &"one")); assert_eq!(iter.next().unwrap(), (&3, &"three")); assert_eq!(iter.next().unwrap(), (&2, &"two")); // Insert a fourth element. // This will automatically pop the least recently accessed one. map.insert(4, "four"); // Still the same number of elements. assert_eq!(map.len(), 3); // And this is the one which was removed. assert!(map.peek(&2).is_none()); // And here's the new order. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&4, &"four")); assert_eq!(iter.next().unwrap(), (&1, &"one")); assert_eq!(iter.next().unwrap(), (&3, &"three")); ``` -------------------------------- ### Any Trait Implementation Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByLength.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides the ability to get the TypeId of a type, useful for dynamic trait object handling. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### default Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LruMap with default values. ```APIDOC ## default ### Description Returns the “default value” for a type. ### Method `default` ### Returns - Self - A new LruMap with default configuration. ``` -------------------------------- ### Basic LRU Map Usage Source: https://docs.rs/schnellru/0.2.4/schnellru/index.html?search=std%3A%3Avec Demonstrates the basic usage of LruMap with a length-based limiter. Shows insertion, access, iteration order, and automatic eviction of the least recently accessed element. ```rust use schnellru::{LruMap, ByLength}; let mut map = LruMap::new(ByLength::new(3)); // Insert three elements. map.insert(1, "one"); map.insert(2, "two"); map.insert(3, "three"); assert_eq!(map.len(), 3); // They're ordered according to which one was inserted last. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&3, &"three")); assert_eq!(iter.next().unwrap(), (&2, &"two")); assert_eq!(iter.next().unwrap(), (&1, &"one")); // Access the least recently inserted one. assert_eq!(*map.get(&1).unwrap(), "one"); // Now the order's changed. // The element we've accessed was moved to the front. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&1, &"one")); assert_eq!(iter.next().unwrap(), (&3, &"three")); assert_eq!(iter.next().unwrap(), (&2, &"two")); // Insert a fourth element. // This will automatically pop the least recently accessed one. map.insert(4, "four"); // Still the same number of elements. assert_eq!(map.len(), 3); // And this is the one which was removed. assert!(map.peek(&2).is_none()); // And here's the new order. let mut iter = map.iter(); assert_eq!(iter.next().unwrap(), (&4, &"four")); assert_eq!(iter.next().unwrap(), (&1, &"one")); assert_eq!(iter.next().unwrap(), (&3, &"three")); ``` -------------------------------- ### Get Maximum Memory Usage Limit Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByMemoryUsage.html Retrieves the maximum memory usage limit configured for the ByMemoryUsage limiter. ```rust pub const fn max_memory_usage(&self) -> usize ``` -------------------------------- ### Create LruMap with Memory Budget Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LruMap with a specified memory budget using the default hasher. Memory is not preallocated. ```rust pub fn with_memory_budget(memory_budget: usize) -> Self ``` -------------------------------- ### rfold() Method Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html Reduces the iterator's elements to a single value, starting from the back. This is part of the DoubleEndedIterator trait. ```rust fn rfold(self, init: B, f: F) -> B where Self: Sized, F: FnMut(B, Self::Item) -> B, ``` -------------------------------- ### Try Convert From Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByLength.html?search=u32+-%3E+bool Performs a conversion from type `U` to type `T`, returning a `Result`. The conversion logic is defined by `U: Into`. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search= Consumes an iterator, creating two collections from it. ```APIDOC ## partition(self, f: F) ### Description Consumes an iterator, creating two collections from it. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Iter.html?search=std%3A%3Avec Consumes an iterator, creating two collections from it. ```APIDOC ## partition(self, f: F) -> (B, B) ### Description Divides the iterator's elements into two collections based on a predicate. ### Method (Called directly on an iterator) ### Parameters #### Closure Parameter - **f**: FnMut(&Self::Item) -> bool - The predicate used to partition elements. #### Type Parameter - **B**: Default + Extend - The type of the two collections to create. ### Response A tuple containing two collections of type `B`, one for elements where the predicate is true, and one for where it is false. ``` -------------------------------- ### rfold method for Iter Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Iter.html?search=u32+-%3E+bool Reduces the iterator's elements to a single value, starting from the back. This method consumes the iterator. ```rust fn rfold(self, init: B, f: F) -> B where Self: Sized, F: FnMut(B, Self::Item) -> B, ``` -------------------------------- ### take Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search=u32+-%3E+bool Creates an iterator that yields at most the first `n` elements. If the underlying iterator ends sooner, it yields fewer elements. ```APIDOC ## fn take(self, n: usize) -> Take ### Description Creates an iterator that yields the first `n` elements, or fewer if the underlying iterator ends sooner. ### Parameters - `n`: The maximum number of elements to yield. ``` -------------------------------- ### Create LruMap with Memory Budget and Hasher Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LruMap configured for memory usage with a specific budget and a custom hasher. Memory is not preallocated. ```rust pub const fn with_memory_budget_and_hasher( memory_budget: usize, hasher: S, ) -> Self ``` -------------------------------- ### fold Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search=u32+-%3E+bool Folds all elements of the iterator into a single value by repeatedly applying a given function. It starts with an initial value and updates it with each element. ```APIDOC ## fold ### Description Folds every element into an accumulator by applying an operation, returning the final result. ### Method Signature `fn fold(self, init: B, f: F) -> B` ### Type Constraints - `Self: Sized` - `F: FnMut(B, Self::Item) -> B` ``` -------------------------------- ### rfold Method for IterMut Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search= Implements the rfold method for IterMut, reducing the iterator's elements to a single value starting from the back. ```rust fn rfold(self, init: B, f: F) -> B where Self: Sized, F: FnMut(B, Self::Item) -> B, ``` -------------------------------- ### by_ref Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=u32+-%3E+bool Creates a "by reference" adapter for an iterator. ```APIDOC ## fn by_ref(&mut self) -> &mut Self ### Description Creates a “by reference” adapter for this instance of `Iterator`. ### Returns A mutable reference to the iterator itself. ``` -------------------------------- ### LruMap::with_memory_budget_and_hasher Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LRU map with a memory budget and a custom hasher. ```APIDOC ## LruMap::with_memory_budget_and_hasher ### Description Creates a new empty map with a given `memory_budget` and `hasher`. This configures the limiter so that the map can use at most `memory_budget` bytes of memory. This does not preallocate any memory. ### Method `pub const fn with_memory_budget_and_hasher(memory_budget: usize, hasher: S) -> Self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (LruMap) - A new empty LRU map with the specified memory budget and hasher. ### Response Example None ``` -------------------------------- ### Get Value by Key (Promote to MRU) Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Retrieves a mutable reference to a value by its key. If found, the element is promoted to the most recently used position. ```rust pub fn get( &mut self, key: &(impl Hash + PartialEq + ?Sized), ) -> Option<&mut V> ``` -------------------------------- ### Get Guaranteed Capacity Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Returns the current guaranteed capacity, which is a lower bound on elements the map can hold without allocating. This value can fluctuate. ```rust pub fn guaranteed_capacity(&self) -> usize ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search= Consumes an iterator and creates two collections based on a predicate. ```APIDOC ## fn partition(self, f: F) -> (B, B) ### Description Consumes an iterator, creating two collections from it based on a predicate. ### Method `partition` ### Parameters - `f`: A closure that takes an item and returns a boolean. Items for which the closure returns `true` go into the first collection, and others into the second. ### Returns A tuple containing two collections (`B`), where `B` implements `Default` and `Extend`. ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Consumes an iterator and creates two collections based on a predicate. ```APIDOC ## fn partition(self, f: F) -> (B, B) ### Description Consumes an iterator, creating two collections from it based on a predicate function. ### Parameters - `f`: A closure that takes a reference to an item and returns a boolean. Items for which the closure returns `true` go into the first collection, and those for which it returns `false` go into the second. ### Returns A tuple containing two collections (`B`), where `B` implements `Default` and `Extend`. ``` -------------------------------- ### Iterator Trait Implementation for IterMut Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html Provides core iteration functionality, including getting the next element and estimating the iterator's size. ```APIDOC ### impl Iterator for IterMut #### fn next(&mut self) -> Option Advances the iterator and returns the next value. #### fn size_hint(&self) -> (usize, Option) Returns the bounds on the remaining length of the iterator. ``` -------------------------------- ### try_rfold Method for IterMut Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search= Implements the try_rfold method for IterMut, which is the reverse version of Iterator::try_fold(). It processes elements starting from the back of the iterator. ```rust fn try_rfold(&mut self, init: B, f: F) -> R where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try, ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=std%3A%3Avec Consumes an iterator and creates two collections based on a predicate. ```APIDOC ## partition ### Description Consumes an iterator, creating two collections from it based on a predicate. ### Signature `fn partition(self, f: F) -> (B, B)` ### Type Parameters - `B`: The type of the collections, which must implement `Default` and `Extend`. - `F`: The type of the predicate function, which takes a reference to an item and returns a boolean. ### Constraints - `Self: Sized` - `B: Default + Extend` - `F: FnMut(&Self::Item) -> bool` ### Returns A tuple containing two collections: the first with elements for which the predicate returned `true`, and the second with elements for which it returned `false`. ``` -------------------------------- ### Get or Insert Value (Fallible) Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Similar to `get_or_insert`, but allows the value-generating closure to return a Result. If an element is found or inserted, it's promoted to most recently used. ```rust pub fn get_or_insert_fallible<'a, E>( &mut self, key: impl Into> + Hash + PartialEq + ?Sized, get: impl FnOnce() -> Result, ) -> Result, E> where L::KeyToInsert<'a>: Hash + PartialEq, ``` -------------------------------- ### Create LruMap with Limiter and Hasher Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LruMap with a specified limiter and a custom hasher. ```rust pub const fn with_hasher(limiter: L, hasher: S) -> Self ``` -------------------------------- ### partition_in_place Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search= Reorders elements in-place based on a predicate. This is a nightly-only experimental API. ```APIDOC ## fn partition_in_place<'a, T, P>(self, predicate: P) -> usize ### Description Reorders the elements of this iterator _in-place_ according to the given predicate, such that all those that return `true` precede all those that return `false`. ### Method `partition_in_place` ### Parameters - `predicate`: A closure that takes a reference to an element and returns a boolean. ### Returns The number of `true` elements found. ### Notes This is a nightly-only experimental API. Requires the iterator to be a `DoubleEndedIterator` over mutable references. ``` -------------------------------- ### partition_in_place Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Reorders elements in-place based on a predicate. This is a nightly-only experimental API. ```APIDOC ## fn partition_in_place<'a, T, P>(self, predicate: P) -> usize ### Description Reorders the elements of this iterator in-place according to a given predicate, such that all elements for which the predicate returns `true` precede all elements for which it returns `false`. ### Parameters - `predicate`: A closure that takes a reference to an element and returns a boolean. ### Returns The number of elements for which the predicate returned `true`. ### Notes This is a nightly-only experimental API. ``` -------------------------------- ### Iterator Trait Implementation for Drain Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides core iterator functionality for the `Drain` struct, including methods to get the next item, estimate remaining length, and consume the iterator. ```rust type Item = (K, V) ``` ```rust fn next(&mut self) -> Option ``` ```rust fn size_hint(&self) -> (usize, Option) ``` ```rust fn count(self) -> usize where Self: Sized, Consumes the iterator, counting the number of iterations and returning it. Read more 1.0.0 (const: unstable) · Source ``` ```rust fn last(self) -> Option where Self: Sized, Consumes the iterator, returning the last element. Read more ``` ```rust fn advance_by(&mut self, n: usize) -> Result<(), NonZero> 🔬This is a nightly-only experimental API. (`iter_advance_by`) Advances the iterator by `n` elements. Read more 1.0.0 (const: unstable) · Source ``` ```rust fn nth(&mut self, n: usize) -> Option Returns the `n`th element of the iterator. Read more 1.28.0 (const: unstable) · Source ``` ```rust fn step_by(self, step: usize) -> StepBy where Self: Sized, Creates an iterator starting at the same point, but stepping by the given amount at each iteration. Read more 1.0.0 (const: unstable) · Source ``` ```rust fn chain(self, other: U) -> Chain::IntoIter> where Self: Sized, U: IntoIterator, Takes two iterators and creates a new iterator over both in sequence. Read more 1.0.0 (const: unstable) · Source ``` ```rust fn zip(self, other: U) -> Zip::IntoIter> where Self: Sized, U: IntoIterator, ‘Zips up’ two iterators into a single iterator of pairs. Read more ``` ```rust fn intersperse(self, separator: Self::Item) -> Intersperse where Self: Sized, Self::Item: Clone, 🔬This is a nightly-only experimental API. (`iter_intersperse`) Creates a new iterator which places a copy of `separator` between items of the original iterator. Read more ``` -------------------------------- ### partition_in_place Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=std%3A%3Avec Reorders elements in-place based on a predicate. This is a nightly-only experimental API. ```APIDOC ## partition_in_place ### Description Reorders the elements of this iterator _in-place_ according to the given predicate, such that all those that return `true` precede all those that return `false`. Returns the number of `true` elements found. ### Signature `fn partition_in_place<'a, T, P>(self, predicate: P) -> usize` ### Type Parameters - `'a`: Lifetime parameter. - `T`: The type of the elements in the iterator. - `P`: The type of the predicate function, which takes a reference to an element and returns a boolean. ### Constraints - `T: 'a` - `Self: Sized + DoubleEndedIterator` - `P: FnMut(&T) -> bool` ### Returns The number of elements for which the predicate returned `true`. ### Stability This is a nightly-only experimental API. ``` -------------------------------- ### Nightly-Only Experimental Hasher APIs Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.DefaultHasher.html?search=u32+-%3E+bool Provides implementations for experimental, nightly-only APIs for writing length prefixes and string slices into the hasher. ```rust fn write_length_prefix(&mut self, len: usize) ``` ```rust fn write_str(&mut self, s: &str) ``` -------------------------------- ### Get Value by Hash and Equality Check (Promote to MRU) Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Retrieves a mutable reference to a value using its hash and an equality predicate. If found, the element is promoted to the most recently used position. ```rust pub fn get_by_hash( &mut self, hash: u64, is_eq: impl FnMut(&K, &V) -> bool, ) -> Option<&mut V> ``` -------------------------------- ### step_by() Method Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html Creates a new iterator that skips elements according to the specified step. The original iterator is consumed. ```rust fn step_by(self, step: usize) -> StepBy where Self: Sized, ``` -------------------------------- ### LruMap::with_memory_budget Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new LRU map with a specified memory budget using the default hasher. ```APIDOC ## LruMap::with_memory_budget ### Description Creates a new empty map with a given `memory_budget`. This will configure the limiter so that the map can use at most `memory_budget` bytes of memory. This does not preallocate any memory. ### Method `pub fn with_memory_budget(memory_budget: usize) -> Self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (LruMap) - A new empty LRU map with the specified memory budget. ### Response Example None ``` -------------------------------- ### clone_from Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Performs copy-assignment from a source LruMap. ```APIDOC ## clone_from ### Description Performs copy-assignment from `source`. ### Method `clone_from` ### Parameters #### Path Parameters - **source** (Self) - Required - The LruMap to copy data from. ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Consumes an iterator, creating two collections based on a predicate. ```APIDOC ## partition(self, f: F) -> (B, B) ### Description Consumes an iterator, creating two collections from it. Elements for which the predicate `f` returns `true` go into the first collection, and the rest go into the second. ### Parameters - `f`: A closure that takes a reference to `Self::Item` and returns a boolean. ### Example ```rust let data = vec![1, 2, 3, 4, 5]; let (even, odd): (Vec<_>, Vec<_>) = data.into_iter().partition(|&x| x % 2 == 0); // even will be [2, 4] // odd will be [1, 3, 5] ``` ``` -------------------------------- ### fmt Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Formats the LruMap for debugging purposes. ```APIDOC ## fmt ### Description Formats the value using the given formatter. ### Method `fmt` ### Parameters #### Path Parameters - **f** (&mut Formatter<'_>) - Required - The formatter to use. ``` -------------------------------- ### map_windows Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search= Calls a function for each contiguous window of size N over the iterator and returns an iterator over the results. This is a nightly-only experimental API. ```APIDOC ## fn map_windows(self, f: F) -> MapWindows ### Description Calls the given function `f` for each contiguous window of size `N` over `self` and returns an iterator over the outputs of `f`. Like `slice::windows()`, the windows during mapping overlap as well. ### Method `map_windows` ### Parameters - `f` (F): A closure that takes a slice representing the window and returns a value. ### Type Parameters - `F`: The closure type that implements `FnMut(&[Self::Item; N]) -> R`. - `R`: The type of the elements returned by the closure. - `N`: The size of the window (compile-time constant). ### Returns A `MapWindows` iterator. ### Notes This is a nightly-only experimental API. ``` -------------------------------- ### map_windows Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Calls a function for each contiguous window of size N over the iterator and returns an iterator over the results. This is a nightly-only experimental API. ```APIDOC ## fn map_windows(self, f: F) -> MapWindows ### Description Calls the given function `f` for each contiguous window of size `N` over `self` and returns an iterator over the outputs of `f`. Like `slice::windows()`, the windows during mapping overlap as well. ### Parameters - `f` (FnMut(&[Self::Item; N]) -> R) - A closure that processes a window of size N. ### Returns A `MapWindows` iterator. ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html Consumes an iterator, creating two collections from it based on a predicate. ```APIDOC ## fn partition(self, f: F) -> (B, B) ### Description Consumes an iterator, creating two collections from it. ### Parameters - `f`: A closure that takes an item and returns a boolean. Items for which the closure returns `true` go into the first collection, and others go into the second. ### Returns A tuple containing two collections: the first for elements where the predicate was true, and the second for elements where it was false. ``` -------------------------------- ### CloneToUninit Trait Implementation (Nightly) Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByLength.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E An experimental nightly-only feature for performing copy-assignment to uninitialized memory. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### product Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=std%3A%3Avec Iterates over the entire iterator, multiplying all the elements. The product type `P` must implement `Product` for the iterator's item type. ```APIDOC ## product

(self) -> P ### Description Iterates over the entire iterator, multiplying all the elements. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method N/A (Method on Iterator trait) ### Endpoint N/A ### Request Example None ### Response #### Success Response - **P** - The product of the elements in the iterator. ``` -------------------------------- ### Create LruMap with Limiter and Hasher Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html?search=u32+-%3E+bool Creates a new LruMap with a specified limiter and hasher. This provides fine-grained control over both eviction and hashing. ```rust pub const fn with_hasher(limiter: L, hasher: S) -> Self ``` -------------------------------- ### from Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates an LruMap from a value of the same type. ```APIDOC ## from ### Description Returns the argument unchanged. ### Method `from` ### Parameters #### Path Parameters - **t** (T) - Required - The value to convert from. ``` -------------------------------- ### inspect Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html Performs an action for each element without consuming it. ```APIDOC ## fn inspect(self, f: F) -> Inspect ### Description Does something with each element of an iterator, passing the value on. ### Method Iterator adapter ### Parameters - **f**: FnMut(&Self::Item) - The closure to execute for each element. ### Returns A new iterator of type `Inspect`. ``` -------------------------------- ### Generic Blanket Implementations Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.DefaultHasher.html Demonstrates blanket implementations of standard traits like Any, Borrow, From, Into, and TryFrom/TryInto for generic types. ```rust fn type_id(&self) -> TypeId ``` ```rust fn borrow(&self) -> &T ``` ```rust fn borrow_mut(&mut self) -> &mut T ``` ```rust fn from(t: T) -> T ``` ```rust fn into(self) -> U ``` ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### try_from Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Attempts to convert a value into an LruMap. ```APIDOC ## try_from ### Description Attempts to convert a value into an LruMap. ### Method `try_from` ### Parameters #### Path Parameters - **u** (U) - Required - The value to attempt to convert. ``` -------------------------------- ### borrow Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Immutably borrows the LruMap. ```APIDOC ## borrow ### Description Immutably borrows from an owned value. ### Method `borrow` ### Returns - &T - An immutable reference to the borrowed value. ``` -------------------------------- ### map_windows Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=u32+-%3E+bool Calls a function for each contiguous window of size N over the iterator and returns an iterator over the outputs. ```APIDOC ## fn map_windows(self, f: F) -> MapWindows ### Description Calls the given function `f` for each contiguous window of size `N` over `self` and returns an iterator over the outputs of `f`. Like `slice::windows()`, the windows during mapping overlap as well. ### Parameters * `f` (FnMut(&[Self::Item; N]) -> R) - A closure that takes a slice representing the window and returns a mapped value. ### Returns A `MapWindows` iterator. ### Notes This is a nightly-only experimental API. ``` -------------------------------- ### Implement Debug for Unlimited Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Unlimited.html?search= Enables the formatting of the Unlimited limiter for debugging purposes. ```rust impl Debug for Unlimited { fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "Unlimited") } } ``` -------------------------------- ### to_owned Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates an owned version of the LruMap. ```APIDOC ## to_owned ### Description Creates owned data from borrowed data, usually by cloning. ### Method `to_owned` ### Returns - T - An owned version of the data. ``` -------------------------------- ### Clone Implementation for UnlimitedCompact Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.UnlimitedCompact.html Provides methods for cloning UnlimitedCompact instances. ```rust fn clone(&self) -> UnlimitedCompact ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### partition Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Iter.html Consumes an iterator and creates two collections based on a predicate. Elements for which the predicate is true go into the first collection, and the rest go into the second. ```APIDOC ## fn partition(self, f: F) -> (B, B) ### Description Consumes an iterator, creating two collections from it. ### Parameters - **f**: (FnMut(&Self::Item) -> bool) - The closure that determines which collection an element belongs to. ### Returns - `(B, B)`: A tuple containing two collections: the first for elements where `f` returned `true`, the second for elements where `f` returned `false`. ### Related - `Self`: The iterator itself. - `B`: The type of the collections, which must implement `Default` and `Extend`. ``` -------------------------------- ### step_by Method for IterMut Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.IterMut.html?search= Implements the step_by method for IterMut, creating an iterator that steps by a given amount at each iteration. ```rust fn step_by(self, step: usize) -> StepBy where Self: Sized, ``` -------------------------------- ### Create New LruMap with Seed and Limiter Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new empty LruMap with a specified limiter and a fixed seed for the hasher. Useful for deterministic behavior. ```rust pub const fn with_seed(limiter: L, seed: [u64; 4]) -> Self ``` -------------------------------- ### step_by method for Iter Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Iter.html?search=u32+-%3E+bool Creates a new iterator that steps through the original iterator by a specified amount at each iteration. ```rust fn step_by(self, step: usize) -> StepBy where Self: Sized, ``` -------------------------------- ### LruMap::with_memory_budget Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html?search=u32+-%3E+bool Creates a new LRU map with a specified memory budget. ```APIDOC ## LruMap::with_memory_budget ### Description Creates a new empty map with a given `memory_budget`. This configures the limiter so that the map can use at most `memory_budget` bytes of memory. This does not preallocate any memory. ### Method `with_memory_budget(memory_budget: usize) -> Self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Self** (LruMap) - A new empty LRU map with a memory budget. #### Response Example None ``` -------------------------------- ### CloneToUninit Trait Implementation for Unlimited Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Unlimited.html?search=u32+-%3E+bool Implements the nightly-only `CloneToUninit` trait for `Unlimited`, enabling copying to uninitialized memory. ```rust impl CloneToUninit for T where T: Clone { unsafe fn clone_to_uninit(&self, dest: *mut u8) { // ... } } ``` -------------------------------- ### map_windows Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=std%3A%3Avec Calls a function for each contiguous window of size N over the iterator and returns an iterator over the results. This is an experimental API. ```APIDOC ## fn map_windows(self, f: F) -> MapWindows ### Description Calls the given function `f` for each contiguous window of size `N` over `self` and returns an iterator over the outputs of `f`. ### Method `map_windows` ### Parameters - `f` (FnMut(&[Self::Item; N]) -> R) - A closure that processes a window of size `N`. ### Note This is a nightly-only experimental API. ``` -------------------------------- ### map_windows Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Iter.html?search=u32+-%3E+bool Calls a function for each contiguous window of size N over the iterator and returns an iterator over the results. This is an experimental API. ```APIDOC ## fn map_windows(self, f: F) -> MapWindows ### Description Calls the given function `f` for each contiguous window of size `N` over `self` and returns an iterator over the outputs of `f`. Windows overlap. ### Parameters - **f** (FnMut(&[Self::Item; N]) -> R) - The function to call for each window. ### Type Parameters - **N** (const usize) - The size of the sliding window. ### Returns A new iterator of type `MapWindows`. ### Note This is a nightly-only experimental API. ``` -------------------------------- ### LruMap::new Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html?search= Creates a new empty LRU map with a specified limiter. The limiter defines the eviction policy. ```APIDOC ## LruMap::new ### Description Creates a new empty map with a given `limiter`. The limiter determines how elements are evicted when the map reaches its capacity. ### Method `new` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Self) - Returns a new, empty `LruMap` instance. ### Response Example None ``` -------------------------------- ### into Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Converts the LruMap into another type that can be created from it. ```APIDOC ## into ### Description Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### Method `into` ### Returns - U - The converted value. ``` -------------------------------- ### borrow_mut Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Mutably borrows the LruMap. ```APIDOC ## borrow_mut ### Description Mutably borrows from an owned value. ### Method `borrow_mut` ### Returns - &mut T - A mutable reference to the borrowed value. ``` -------------------------------- ### Create New LruMap with Limiter Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.LruMap.html Creates a new empty LruMap with a specified limiter. This is the basic constructor for LruMap. ```rust pub fn new(limiter: L) -> Self ``` -------------------------------- ### next() Method Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html Advances the iterator and returns the next key-value pair. This is the standard method for consuming an iterator sequentially. ```rust fn next(&mut self) -> Option ``` -------------------------------- ### Clone Implementation for ByLength Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.ByLength.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Provides the ability to create a duplicate of a ByLength limiter instance. ```rust fn clone(&self) -> ByLength ``` -------------------------------- ### zip() Method Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html Combines this iterator with another, creating a new iterator that yields pairs of corresponding elements. Iteration stops when the shorter iterator is exhausted. ```rust fn zip(self, other: U) -> Zip::IntoIter> where Self: Sized, U: IntoIterator, ``` -------------------------------- ### inspect Source: https://docs.rs/schnellru/0.2.4/schnellru/struct.Drain.html?search=u32+-%3E+bool Does something with each element of an iterator, passing the value on. ```APIDOC ## fn inspect(self, f: F) -> Inspect ### Description Does something with each element of an iterator, passing the value on. ### Parameters * `f` (FnMut(&Self::Item)) - A closure that is called with a reference to each item. ### Returns An `Inspect` iterator. ```