### Implement Match Methods (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides implementations for the `Match` struct, including methods to retrieve the starting position (`start`), ending position (`end`), and the associated value (`value`) of a match. The `value` method requires the generic type `V` to implement the `Copy` trait. ```rust pub fn start(&self) -> usize Ending position of the match. pub fn end(&self) -> usize Value associated with the pattern. pub fn value(&self) -> V Value associated with the pattern. ``` -------------------------------- ### Find Non-Overlapped Occurrences (Leftmost First) with Daachorse Source: https://docs.rs/daachorse/latest/daachorse/index Demonstrates finding the earliest registered pattern that starts at a given position, using `DoubleArrayAhoCorasickBuilder` with `MatchKind::LeftmostFirst`. This implements the 'leftmost first match' semantic. ```rust use daachorse::{DoubleArrayAhoCorasickBuilder, MatchKind}; let patterns = vec!["ab", "a", "abcd"]; let pma = DoubleArrayAhoCorasickBuilder::new() .match_kind(MatchKind::LeftmostFirst) .build(&patterns) .unwrap(); let mut it = pma.leftmost_find_iter("abcd"); let m = it.next().unwrap(); assert_eq!((0, 2, 0), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Basic Type Information Traits (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Implements `Any` for all types, providing a `type_id` method to get the unique identifier of a type at runtime. Also implements `Borrow` and `BorrowMut` for accessing underlying data immutably or mutably. ```Rust impl Any for T where T: 'static + ?Sized Source§ fn type_id(&self) -> TypeId ``` ```Rust impl Borrow for T where T: ?Sized Source§ fn borrow(&self) -> &T ``` ```Rust impl BorrowMut for T where T: ?Sized Source§ fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### Find Non-Overlapped Occurrences (Leftmost Longest) with Daachorse Source: https://docs.rs/daachorse/latest/daachorse/index Illustrates finding the longest non-overlapping pattern starting from each position using `DoubleArrayAhoCorasickBuilder` with `MatchKind::LeftmostLongest`. This requires configuring the builder before constructing the automaton. ```rust use daachorse::{DoubleArrayAhoCorasickBuilder, MatchKind}; let patterns = vec!["ab", "a", "abcd"]; let pma = DoubleArrayAhoCorasickBuilder::new() .match_kind(MatchKind::LeftmostLongest) .build(&patterns) .unwrap(); let mut it = pma.leftmost_find_iter("abcd"); let m = it.next().unwrap(); assert_eq!((0, 4, 2), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Find Overlapping Occurrences with Daachorse Source: https://docs.rs/daachorse/latest/daachorse/index Demonstrates how to find all pattern occurrences in a text, allowing for positional overlap, using `DoubleArrayAhoCorasick::find_overlapping_iter()`. The crate assigns unique identifiers to patterns based on their input order, and results include the match's start and end byte positions along with its identifier. ```rust use daachorse::DoubleArrayAhoCorasick; let patterns = vec!["bcd", "ab", "a"]; let pma = DoubleArrayAhoCorasick::new(patterns).unwrap(); let mut it = pma.find_overlapping_iter("abcd"); let m = it.next().unwrap(); assert_eq!((0, 1, 2), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((0, 2, 1), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((1, 4, 0), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Get Index of First Element Satisfying Condition (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Searches an iterator for an element that satisfies a given predicate function and returns its zero-based index. Returns `None` if no such element is found. ```rust fn position

(&mut self, predicate: P) -> Option where Self: Sized, P: FnMut(Self::Item) -> bool, ``` -------------------------------- ### Define daachorse Match Struct (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Defines the `Match` struct, a generic structure to hold match results. It's used to represent a match found by a pattern, storing start and end positions along with an associated value. ```rust pub struct Match { /* private fields */ } ``` -------------------------------- ### Create and Use DoubleArrayAhoCorasickBuilder Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct Demonstrates creating a DoubleArrayAhoCorasickBuilder, building an automaton from a list of patterns, and iterating through matches in a text. ```rust use daachorse::DoubleArrayAhoCorasickBuilder; let builder = DoubleArrayAhoCorasickBuilder::new(); let patterns = vec!["bcd", "ab", "a"]; let pma = builder.build(patterns).unwrap(); let mut it = pma.find_iter("abcd"); let m = it.next().unwrap(); assert_eq!((0, 1, 2), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((1, 4, 0), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### CharwiseDoubleArrayAhoCorasickBuilder Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Builder for creating CharwiseDoubleArrayAhoCorasick automata. ```APIDOC ## Struct CharwiseDoubleArrayAhoCorasickBuilder ### Description Builder for `CharwiseDoubleArrayAhoCorasick`. ### Methods #### `new()` Creates a new `CharwiseDoubleArrayAhoCorasickBuilder`. ##### Example ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patterns = vec!["全世界", "世界", "に"]; let builder = CharwiseDoubleArrayAhoCorasickBuilder::new(); let pma = builder.build(patterns).unwrap(); ``` #### `match_kind(kind: MatchKind)` Specifies `MatchKind` to build. * `kind` (MatchKind) - Match kind. #### `num_free_blocks(n: u32)` Specifies the number of last blocks to search bases. * `n` (u32) - The number of last blocks. *Panics*: `n` must be greater than or equal to 1. #### `build(patterns: I)` Builds and returns a new `CharwiseDoubleArrayAhoCorasick` from input patterns. * `patterns` (I: IntoIterator, P: AsRef) - List of patterns. *Returns*: `Result>` *Errors*: `DaachorseError` is returned under various conditions such as empty patterns, zero-length patterns, duplicate entries, or scale issues. ##### Example ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patterns = vec!["全世界", "世界", "に"]; let pma = CharwiseDoubleArrayAhoCorasickBuilder::new() .build(patterns) .unwrap(); ``` #### `build_with_values(patvals: I)` Builds and returns a new `CharwiseDoubleArrayAhoCorasick` from input pattern-value pairs. * `patvals` (I: IntoIterator, P: AsRef, V: Copy) - List of pattern-value pairs. *Returns*: `Result>` *Errors*: `DaachorseError` is returned under various conditions such as empty patterns, zero-length patterns, duplicate patterns, or scale issues. ##### Example ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patvals = vec![("全世界", 0), ("世界", 10), ("に", 100)]; let pma = CharwiseDoubleArrayAhoCorasickBuilder::new() .build_with_values(patvals) .unwrap(); ``` ``` -------------------------------- ### Rust Iterator Type Identification Source: https://docs.rs/daachorse/latest/daachorse/charwise/iter/struct Shows how to get the `TypeId` of an iterator's elements. This implementation is part of the `Any` trait, allowing for dynamic type checking. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Rust Get TypeId Method Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct The `type_id()` method returns the `TypeId` of a value, which is a unique identifier for the type at runtime. This is useful for type comparisons and dynamic dispatch scenarios. ```Rust /// Gets the `TypeId` of `self`. /// /// # Examples /// /// ``` /// use std::any::Any; /// /// let x: i32 = 5; /// let type_id_i32 = x.type_id(); /// /// let y: &str = "hello"; /// let type_id_str = y.type_id(); /// /// assert_ne!(type_id_i32, type_id_str); /// ``` fn type_id(&self) -> TypeId ``` -------------------------------- ### DoubleArrayAhoCorasickBuilder API Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct This section details the methods available for creating and configuring a DoubleArrayAhoCorasickBuilder. ```APIDOC ## DoubleArrayAhoCorasickBuilder ### Description Builder of `DoubleArrayAhoCorasick`. ### Methods #### `new()` Creates a new `DoubleArrayAhoCorasickBuilder`. ##### Example ```rust use daachorse::DoubleArrayAhoCorasickBuilder; let builder = DoubleArrayAhoCorasickBuilder::new(); let patterns = vec!["bcd", "ab", "a"]; let pma = builder.build(patterns).unwrap(); ``` #### `match_kind(kind: MatchKind)` Specifies `MatchKind` to build. `MatchKind` determines how overlapping matches are handled. ##### Arguments * `kind` - Match kind (e.g., `MatchKind::LeftmostLongest`). ##### Example ```rust use daachorse::{DoubleArrayAhoCorasickBuilder, MatchKind}; let patterns = vec!["ab", "abcd"]; let pma = DoubleArrayAhoCorasickBuilder::new() .match_kind(MatchKind::LeftmostLongest) .build(&patterns) .unwrap(); ``` #### `num_free_blocks(n: u32)` Specifies the number of last blocks to search bases. This can affect construction time and memory efficiency. ##### Arguments * `n` - The number of last blocks. Must be greater than or equal to 1. ##### Panics Panics if `n` is less than 1. #### `build(patterns: I)` Builds and returns a new `DoubleArrayAhoCorasick` from input patterns. The value `i` is automatically associated with `patterns[i]`. ##### Arguments * `patterns` - An iterator of patterns, where each pattern is a byte slice. ##### Errors Returns `DaachorseError` under several conditions, including empty or zero-length patterns, duplicate patterns, or scale issues. ##### Example ```rust use daachorse::DoubleArrayAhoCorasickBuilder; let builder = DoubleArrayAhoCorasickBuilder::new(); let patterns = vec!["bcd", "ab", "a"]; let pma = builder.build(patterns).unwrap(); ``` #### `build_with_values(patvals: I)` Builds and returns a new `DoubleArrayAhoCorasick` from input pattern-value pairs. ##### Arguments * `patvals` - An iterator of tuples, where each tuple contains a pattern (byte slice) and its associated value. ##### Errors Returns `DaachorseError` under several conditions, including empty or zero-length patterns, duplicate patterns, or scale issues. ##### Example ```rust use daachorse::DoubleArrayAhoCorasickBuilder; let builder = DoubleArrayAhoCorasickBuilder::new(); let patvals = vec![("bcd", 0), ("ab", 1), ("a", 2), ("e", 1)]; let pma = builder.build_with_values(patvals).unwrap(); ``` ``` -------------------------------- ### Implement CloneToUninit for T (Experimental - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides an experimental, nightly-only blanket implementation of `CloneToUninit` for types that implement `Clone`. This unsafe method allows cloning data directly into uninitialized memory. ```rust impl CloneToUninit for T where T: Clone, unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Implement TryInto for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of `TryInto` for `T` where `U` implements `TryFrom`. This allows fallible conversions from `T` to `U`. ```rust impl TryInto for T where U: TryFrom, type Error = >::Error fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Implement TryFrom for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of `TryFrom` for `T` where `U` implements `Into`. This allows fallible conversions from `U` to `T`. ```rust impl TryFrom for T where U: Into, type Error = Infallible fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Default implementation for CharwiseDoubleArrayAhoCorasickBuilder Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Provides the default value for `CharwiseDoubleArrayAhoCorasickBuilder`, allowing it to be created with default settings. ```rust fn default() -> Self ``` -------------------------------- ### Initialize CharwiseDoubleArrayAhoCorasickBuilder Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Creates a new `CharwiseDoubleArrayAhoCorasickBuilder` for building character-wise Aho-Corasick automatons. This builder is used to configure and construct the automaton from a list of patterns. ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patterns = vec!["全世界", "世界", "に"]; let builder = CharwiseDoubleArrayAhoCorasickBuilder::new(); let pma = builder.build(patterns).unwrap(); let mut it = pma.find_iter("全世界中に"); let m = it.next().unwrap(); assert_eq!((0, 9, 0), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((12, 15, 2), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Build Faster Automaton with CharwiseDoubleArrayAhoCorasick (Rust) Source: https://docs.rs/daachorse/latest/daachorse/index Demonstrates building and using `CharwiseDoubleArrayAhoCorasick` for efficient pattern matching on multibyte characters. This version uses Unicode code points for transitions, offering faster matching compared to byte-wise implementations. ```rust use daachorse::CharwiseDoubleArrayAhoCorasick; let patterns = vec!["全世界", "世界", "に"]; let pma = CharwiseDoubleArrayAhoCorasick::new(patterns).unwrap(); let mut it = pma.find_iter("全世界中に"); let m = it.next().unwrap(); assert_eq!((0, 9, 0), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((12, 15, 2), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Rust: Implement TryInto for Conversions Source: https://docs.rs/daachorse/latest/daachorse/enum Provides the `try_into` method for performing conversions. It returns a `Result` which is either the converted value of type `U` or an error of the associated `TryFrom` error type. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Implement Into for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of `Into` for `T` where `U` implements `From`. This allows conversion from `T` to `U` by calling `U::from(self)`. ```rust impl Into for T where U: From, fn into(self) -> U ``` -------------------------------- ### Build DoubleArrayAhoCorasick with Pattern-Value Pairs Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct Illustrates building a DoubleArrayAhoCorasick automaton using a list of (pattern, value) tuples, allowing custom values to be associated with each pattern. ```rust use daachorse::DoubleArrayAhoCorasickBuilder; let builder = DoubleArrayAhoCorasickBuilder::new(); let patvals = vec![("bcd", 0), ("ab", 1), ("a", 2), ("e", 1)]; let pma = builder.build_with_values(patvals).unwrap(); let mut it = pma.find_iter("abcde"); let m = it.next().unwrap(); assert_eq!((0, 1, 2), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((1, 4, 0), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((4, 5, 1), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Build CharwiseDoubleArrayAhoCorasick from patterns Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Builds a `CharwiseDoubleArrayAhoCorasick` automaton from a collection of string patterns. Each pattern is automatically associated with its index as its value. Errors can occur if patterns are empty, zero-length, duplicated, or if the scale exceeds expectations. ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patterns = vec!["全世界", "世界", "に"]; let pma = CharwiseDoubleArrayAhoCorasickBuilder::new() .build(patterns) .unwrap(); let mut it = pma.find_iter("全世界中に"); let m = it.next().unwrap(); assert_eq!((0, 9, 0), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((12, 15, 2), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Build CharwiseDoubleArrayAhoCorasick with values Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Builds a `CharwiseDoubleArrayAhoCorasick` automaton from a collection of pattern-value pairs. This allows associating custom values with each pattern. Similar to building with patterns, it can return errors for invalid inputs or scale issues. ```rust use daachorse::CharwiseDoubleArrayAhoCorasickBuilder; let patvals = vec![("全世界", 0), ("世界", 10), ("に", 100)]; let pma = CharwiseDoubleArrayAhoCorasickBuilder::new() .build_with_values(patvals) .unwrap(); let mut it = pma.find_iter("全世界中に"); let m = it.next().unwrap(); assert_eq!((0, 9, 0), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((12, 15, 100), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Implement PartialEq for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Implements the `PartialEq` trait for the `Match` struct, enabling equality comparisons between instances. This requires the generic type `V` to implement `PartialEq`. It includes methods for checking equality (`eq`) and inequality (`ne`). ```rust impl PartialEq for Match fn eq(&self, other: &Match) -> bool fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Map Over Iterator Windows (Nightly) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Calls a function for each contiguous window of size `N` over the iterator. Windows overlap, similar to `slice::windows()`. This is a nightly-only experimental API. ```Rust fn map_windows(self, f: F) -> MapWindows where Self: Sized, F: FnMut(&[Self::Item; N]) -> R ``` -------------------------------- ### Specify number of free blocks for builder Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Sets the number of last blocks to search bases in the `CharwiseDoubleArrayAhoCorasickBuilder`. A smaller number improves construction time but may degrade memory efficiency. The value must be at least 1. ```rust pub const fn num_free_blocks(self, n: u32) -> Self ``` -------------------------------- ### Auto Trait Implementations for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Details the auto trait implementations for the `Match` struct, including `Freeze`, `RefUnwindSafe`, `Send`, `Sync`, `Unpin`, and `UnwindSafe`. These implementations depend on the `Match` struct's generic type `V` implementing the corresponding traits. ```rust impl Freeze for Match where V: Freeze, impl RefUnwindSafe for Match where V: RefUnwindSafe, impl Send for Match where V: Send, impl Sync for Match where V: Sync, impl Unpin for Match where V: Unpin, impl UnwindSafe for Match where V: UnwindSafe, ``` -------------------------------- ### Associate Custom Values with Patterns in Daachorse Source: https://docs.rs/daachorse/latest/daachorse/index Explains how to associate arbitrary user-defined values with patterns when building the automaton, using `DoubleArrayAhoCorasick::with_values()`. This method allows for more flexible data association compared to automatic identifier assignment. ```rust use daachorse::DoubleArrayAhoCorasick; let patvals = vec![("bcd", 0), ("ab", 10), ("a", 20)]; let pma = DoubleArrayAhoCorasick::with_values(patvals).unwrap(); let mut it = pma.find_overlapping_iter("abcd"); let m = it.next().unwrap(); assert_eq!((0, 1, 20), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((0, 2, 10), (m.start(), m.end(), m.value())); let m = it.next().unwrap(); assert_eq!((1, 4, 0), (m.start(), m.end(), m.value())); assert_eq!(None, it.next()); ``` -------------------------------- ### Implement From for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of `From` for `T`. This allows a type to be converted into itself, essentially returning the value unchanged. ```rust impl From for T fn from(t: T) -> T ``` -------------------------------- ### Find First Element Matching Predicate Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Searches for the first element in the iterator that satisfies a given predicate and returns it as an `Option`. Returns `None` if no element matches. ```Rust fn find

(&mut self, predicate: P) -> Option where Self: Sized, P: FnMut(&Self::Item) -> bool ``` -------------------------------- ### Create Iterator Reference Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Creates a "by reference" adapter for an iterator instance. This allows borrowing the iterator's state without consuming it. ```Rust fn by_ref(&mut self) -> &mut Self where Self: Sized ``` -------------------------------- ### Rust TryInto Trait: Fallible Automatic Conversion Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct The `TryInto` trait provides a convenient, fallible conversion mechanism similar to `TryFrom`. The `try_into()` method consumes the source value and returns a `Result` of the target type, leveraging underlying `TryFrom` implementations. ```Rust /// The type returned in the event of a conversion error. /// This mirrors the `Error` type defined in the corresponding `TryFrom` implementation. // type Error = >::Error; /// Performs the conversion. /// /// # Examples /// /// ``` /// use std::convert::TryInto; /// /// let s = "hello"; /// let bytes: Vec = s.bytes().collect(); /// let result_vec_u8: Result, _> = bytes.try_into(); /// assert!(result_vec_u8.is_ok()); /// ``` fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Lexicographically Compare Iterators by Partial Function (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Compares two iterators element by element using a provided partial comparison function. It returns `Option` based on the first elements for which the function returns a non-`None` result. This is a nightly-only experimental API. ```rust fn partial_cmp_by(self, other: I, partial_cmp: F) -> Option where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> Option, ``` -------------------------------- ### Struct CharwiseDoubleArrayAhoCorasickBuilder definition Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct Defines the `CharwiseDoubleArrayAhoCorasickBuilder` struct, which is used to configure and build Aho-Corasick automatons for character-wise pattern matching. ```rust pub struct CharwiseDoubleArrayAhoCorasickBuilder { /* private fields */ } ``` -------------------------------- ### Implement StructuralPartialEq for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Implements the `StructuralPartialEq` trait for the `Match` struct. This trait is used for comparing the structure of types, often relevant for generic programming and trait derivations. ```rust impl StructuralPartialEq for Match ``` -------------------------------- ### Implement Clone for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Implements the `Clone` trait for the `Match` struct, allowing instances to be duplicated. This requires the generic type `V` to also implement `Clone`. It includes methods for direct cloning and copying from another instance. ```rust impl Clone for Match fn clone(&self) -> Match fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Type Conversion Traits (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Implements `From`, `Into`, `TryFrom`, and `TryInto` traits for generic types. `From` and `Into` provide straightforward conversions, while `TryFrom` and `TryInto` allow for fallible conversions returning a `Result`. ```Rust impl From for T Source§ fn from(t: T) -> T ``` ```Rust impl Into for T where U: From Source§ fn into(self) -> U ``` ```Rust impl TryFrom for T where U: Into Source§ tpe Error = Infallible fn try_from(value: U) -> Result>::Error> ``` ```Rust impl TryInto for T where U: TryFrom Source§ tpe Error = >::Error fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Try Reduce Iterator (Nightly) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Reduces elements to a single value using a binary operation, propagating failures immediately if the operation returns a `Try` type. Returns `None` if the iterator is empty. This is a nightly-only experimental API. ```Rust fn try_reduce(&mut self, f: impl FnMut(Self::Item, Self::Item) -> R) -> <::Residual as Residual::Output>>>::TryType where Self: Sized, R: Try, ::Residual: Residual> ``` -------------------------------- ### Implement Debug for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Implements the `Debug` trait for the `Match` struct, enabling formatted output for debugging purposes. This implementation requires the generic type `V` to implement `Debug`. ```rust impl Debug for Match fn fmt(&self, f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Implement Any for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of the `Any` trait for any type `T`. This allows any type to be downcast to a specific concrete type at runtime, provided it meets the `'static` lifetime requirement. ```rust impl Any for T where T: 'static + ?Sized, fn type_id(&self) -> TypeId ``` -------------------------------- ### Implement Hash for Match (Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Implements the `Hash` trait for the `Match` struct, allowing instances to be used in hash-based collections. This requires the generic type `V` to implement `Hash`. It includes methods for hashing a single instance and a slice of instances. ```rust impl Hash for Match fn hash<__H: Hasher>(&self, state: &mut __H) fn hash_slice(data: &[Self], state: &mut H) where H: Hasher, Self: Sized, ``` -------------------------------- ### Lexicographically Compare Iterators by Function (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Compares two iterators element by element using a provided comparison function. It returns `Ordering::Less`, `Ordering::Equal`, or `Ordering::Greater` based on the first differing elements. If one iterator is a prefix of the other, the shorter one is considered less. This is a nightly-only experimental API. ```rust fn cmp_by(self, other: I, cmp: F) -> Ordering where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> Ordering, ``` -------------------------------- ### Implement Serializable for i64 in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the signed 64-bit integer type (i64). This enables i64 values to be serialized and deserialized. ```Rust impl Serializable for i64 Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Implement Display for InvalidConversionError (Rust) Source: https://docs.rs/daachorse/latest/daachorse/errors/struct Provides a Display implementation for the InvalidConversionError struct. This enables InvalidConversionError instances to be formatted as user-readable strings, useful for error messages or logging. ```rust impl Display for InvalidConversionError Source§ #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more ``` -------------------------------- ### Implement TryInto for Generic Types T and U (Rust) Source: https://docs.rs/daachorse/latest/daachorse/errors/struct Implements the TryInto trait for generic types T and U, where T can be fallibly converted into U. This is the reciprocal of TryFrom. ```rust impl TryInto for T where U: TryFrom, Source§ #### type Error = >::Error The type returned in the event of a conversion error. Source§ #### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### Implement Serializable for Option in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for Option. This allows optional non-zero unsigned 32-bit integers to be serialized and deserialized. ```Rust impl Serializable for Option Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Implement Borrow for T (Blanket Implementation - Rust) Source: https://docs.rs/daachorse/latest/daachorse/struct Provides a blanket implementation of the `Borrow` trait for any type `T`. This allows a type to be borrowed immutably, facilitating access to its contents without taking ownership. ```rust impl Borrow for T where T: ?Sized, fn borrow(&self) -> &T ``` -------------------------------- ### Try For Each Iterator Item (Nightly) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Applies a fallible function to each item in the iterator, stopping at the first error and returning that error. The function must return a `Try` type. ```Rust fn try_for_each(&mut self, f: F) -> R where Self: Sized, F: FnMut(Self::Item) -> R, R: Try ``` -------------------------------- ### Implement Serializable for i32 in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the signed 32-bit integer type (i32). This enables i32 values to be serialized and deserialized. ```Rust impl Serializable for i32 Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Rust Into Trait: Automatic Type Conversion Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct The `Into` trait provides a convenient way to perform conversions that are defined by a `From` implementation. The `into()` method consumes the source value and returns the target type, often used for chaining operations. ```Rust /// Calls `U::from(self)`. /// That is, this conversion is whatever the implementation of `From for U` chooses to do. /// /// # Examples /// /// ``` /// use std::convert::From; /// /// struct MyInt(i32); /// impl From for MyInt { /// fn from(i: i32) -> Self { /// MyInt(i) /// } /// } /// /// let i = 5; /// let my_int: MyInt = i.into(); /// assert_eq!(my_int.0, 5); /// ``` fn into(self) -> U ``` -------------------------------- ### Implement Serializable for isize in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the signed integer type corresponding to the platform's pointer size (isize). This enables isize values to be serialized and deserialized. ```Rust impl Serializable for isize Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Implement Serializable for usize in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the unsigned integer type corresponding to the platform's pointer size (usize). This enables usize values to be serialized and deserialized. ```Rust impl Serializable for usize Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Rust: `TryInto` Trait for Fallible Conversions Source: https://docs.rs/daachorse/latest/daachorse/charwise/struct The `TryInto` trait allows for fallible conversions from type `T` to type `U`, leveraging an underlying `TryFrom` implementation. It defines an `Error` type and a `try_into` method that returns a `Result`. ```Rust /// The type returned in the event of a conversion error. type Error = >::Error; /// Performs the conversion. fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Lexicographically Compare Iterators Using PartialOrd (Rust) Source: https://docs.rs/daachorse/latest/daachorse/bytewise/iter/struct Compares two iterators element by element using the `PartialOrd` trait. The comparison short-circuits as soon as an order can be determined. If elements are not comparable, `None` is returned. ```rust fn partial_cmp(self, other: I) -> Option where I: IntoIterator, Self::Item: PartialOrd<::Item>, Self: Sized, ``` -------------------------------- ### Iterator Trait Implementations for LestmostFindIterator Source: https://docs.rs/daachorse/latest/daachorse/charwise/iter/struct Provides implementations of the Iterator trait for LestmostFindIterator. This allows for common iteration patterns such as 'next', 'next_chunk', 'size_hint', 'count', 'last', 'advance_by', 'nth', 'step_by', 'chain', 'zip', 'intersperse', 'intersperse_with', 'map', 'for_each', 'filter', 'filter_map', 'enumerate', 'peekable', 'skip_while', 'take_while', and 'map_while'. Some methods are marked as nightly-only experimental APIs. ```rust impl<'a, P, V> Iterator for LestmostFindIterator<'a, P, V> where P: AsRef, V: Copy, { type Item = Match; fn next(&mut self) -> Option; fn next_chunk( &mut self, ) -> Result<[Self::Item; N], IntoIter> where Self: Sized; fn size_hint(&self) -> (usize, Option); fn count(self) -> usize where Self: Sized; fn last(self) -> Option where Self: Sized; fn advance_by(&mut self, n: usize) -> Result<(), NonZero>; fn nth(&mut self, n: usize) -> Option; fn step_by(self, step: usize) -> StepBy where Self: Sized; fn chain(self, other: U) -> Chain::IntoIter> where Self: Sized, U: IntoIterator; fn zip(self, other: U) -> Zip::IntoIter> where Self: Sized, U: IntoIterator; fn intersperse(self, separator: Self::Item) -> Intersperse where Self: Sized, Self::Item: Clone; fn intersperse_with(self, separator: G) -> IntersperseWith where Self: Sized, G: FnMut() -> Self::Item; fn map(self, f: F) -> Map where Self: Sized, F: FnMut(Self::Item) -> B; fn for_each(self, f: F) where Self: Sized, F: FnMut(Self::Item); fn filter

(self, predicate: P) -> Filter where Self: Sized, P: FnMut(&Self::Item) -> bool; fn filter_map(self, f: F) -> FilterMap where Self: Sized, F: FnMut(Self::Item) -> Option; fn enumerate(self) -> Enumerate where Self: Sized; fn peekable(self) -> Peekable where Self: Sized; fn skip_while

(self, predicate: P) -> SkipWhile where Self: Sized, P: FnMut(&Self::Item) -> bool; fn take_while

(self, predicate: P) -> TakeWhile where Self: Sized, P: FnMut(&Self::Item) -> bool; fn map_while(self, predicate: P) -> MapWhile where Self: Sized, P: FnMut(Self::Item) -> Option; fn skip(self, n: usize) -> Skip where Self: Sized; } ``` -------------------------------- ### Implement Serializable for i16 in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the signed 16-bit integer type (i16). This enables i16 values to be serialized and deserialized. ```Rust impl Serializable for i16 Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Rust From Trait: Direct Type Conversion Source: https://docs.rs/daachorse/latest/daachorse/bytewise/struct The `From` trait enables direct type conversions where the conversion is always infallible. The `from()` method takes ownership of the source value and returns the target type. ```Rust /// Returns the argument unchanged. /// /// # Examples /// /// ``` /// let s = String::from("hello"); /// let owned_s = String::from(s); /// assert_eq!(owned_s, "hello"); /// ``` fn from(t: T) -> T ``` -------------------------------- ### Implement Serializable for u64 in Rust Source: https://docs.rs/daachorse/latest/daachorse/trait Provides implementations for the Serializable trait for the unsigned 64-bit integer type (u64). This enables u64 values to be serialized and deserialized. ```Rust impl Serializable for u64 Source§ #### fn serialize_to_vec(&self, dst: &mut Vec) Source§ #### fn deserialize_from_slice(src: &[u8]) -> (Self, &[u8]) Source§ #### fn serialized_bytes() -> usize ``` -------------------------------- ### Implement Debug for InvalidConversionError (Rust) Source: https://docs.rs/daachorse/latest/daachorse/errors/struct Provides a Debug implementation for the InvalidConversionError struct. This allows instances of InvalidConversionError to be formatted for debugging purposes, typically by printing their representation to the console or a log. ```rust impl Debug for InvalidConversionError Source§ #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. Read more ```