Needle

Trait Needle 

Source
pub trait Needle {
    const SIZE: Option<usize>;

    // Required method
    fn as_bytes(&self) -> &[u8] ;
}
Expand description

Needle that can be searched for within a haystack. It allows specialized searcher implementations for needle sizes known at compile time.

Required Associated Constants§

Source

const SIZE: Option<usize>

Set to Some(<usize>) if and only if the needle’s length is known at compile time.

Required Methods§

Source

fn as_bytes(&self) -> &[u8]

Return the slice corresponding to the needle.

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.

Implementations on Foreign Types§

Source§

impl Needle for Vec<u8>

Source§

const SIZE: Option<usize> = None

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl Needle for [u8]

Source§

const SIZE: Option<usize> = None

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl<N: Needle + ?Sized> Needle for &N

Source§

const SIZE: Option<usize> = N::SIZE

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl<N: Needle + ?Sized> Needle for Box<N>

Source§

const SIZE: Option<usize> = N::SIZE

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl<N: Needle + ?Sized> Needle for Rc<N>

Source§

const SIZE: Option<usize> = N::SIZE

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl<N: Needle + ?Sized> Needle for Arc<N>

Source§

const SIZE: Option<usize> = N::SIZE

Source§

fn as_bytes(&self) -> &[u8]

Source§

impl<const N: usize> Needle for [u8; N]

Implementors§