Skip to main content

ByteSubstringMut

Trait ByteSubstringMut 

Source
pub trait ByteSubstringMut: Sealed {
    // Required methods
    fn remove_first_substring(
        &mut self,
        needle: impl AsRef<[u8]>,
    ) -> Option<Range<usize>>;
    fn replace_all_bytes(&mut self, needle: u8, replacement: u8);
}
Expand description

Similar to ByteSubstring but requires the input byte string to be mutable.

Required Methods§

Source

fn remove_first_substring( &mut self, needle: impl AsRef<[u8]>, ) -> Option<Range<usize>>

If the substring is found, the first instance is removed and index range of the removed substring is returned, otherwise None. Searches in the forward direction.

Source

fn replace_all_bytes(&mut self, needle: u8, replacement: u8)

Replace a single byte of the stored sequence. See the Recode trait for a more wholistic approach.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: AsMut<Vec<u8>> + AsRef<[u8]> + Sealed> ByteSubstringMut for T