[][src]Struct boyer_moore_magiclen::character::BMCharacter

pub struct BMCharacter { /* fields omitted */ }

Using Boyer-Moore-MagicLen to search character sub-sequences in any character sequence.

Methods

impl BMCharacter[src]

pub fn from<T: BMCharacterSearchable>(pattern: T) -> Option<BMCharacter>[src]

Create a BMByte instance from a pattern (the search needle).

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

impl BMCharacter[src]

pub fn find_full_all_in<T: BMCharacterSearchable>(&self, text: T) -> Vec<usize>[src]

Find and return the positions of all matched sub-sequences in any text (the haystack).

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![1, 4, 7], bmc.find_full_all_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn find_full_in<T: BMCharacterSearchable>(
    &self,
    text: T,
    limit: usize
) -> Vec<usize>
[src]

Find and return the positions of matched sub-sequences in any text (the haystack). If the limit is set to 0, all sub-sequences will be found.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![1, 4], bmc.find_full_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o'], 2));

impl BMCharacter[src]

pub fn rfind_full_all_in<T: BMCharacterSearchable>(&self, text: T) -> Vec<usize>[src]

Find and return the positions of all matched sub-sequences in any text (the haystack) from its tail to its head.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![7, 4, 1], bmc.rfind_full_all_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn rfind_full_in<T: BMCharacterSearchable>(
    &self,
    text: T,
    limit: usize
) -> Vec<usize>
[src]

Find and return the positions of matched sub-sequences in any text (the haystack) from its tail to its head. If the limit is set to 0, all sub-sequences will be found.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![7, 4], bmc.rfind_full_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o'], 2));

impl BMCharacter[src]

pub fn find_all_in<T: BMCharacterSearchable>(&self, text: T) -> Vec<usize>[src]

Find and return the positions of all matched sub-sequences in any text (the haystack) but not including the overlap.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![1, 7], bmc.find_all_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn find_first_in<T: BMCharacterSearchable>(&self, text: T) -> Option<usize>[src]

Find and return the position of the first matched sub-sequence in any text (the haystack).

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(Some(1), bmc.find_first_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn find_in<T: BMCharacterSearchable>(
    &self,
    text: T,
    limit: usize
) -> Vec<usize>
[src]

Find and return the positions of matched sub-sequences in any text (the haystack) but not including the overlap. If the limit is set to 0, all sub-sequences will be found.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![1], bmc.find_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o'], 1));

impl BMCharacter[src]

pub fn rfind_all_in<T: BMCharacterSearchable>(&self, text: T) -> Vec<usize>[src]

Find and return the positions of all matched sub-sequences in any text (the haystack) but not including the overlap from its tail to its head.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![7, 1], bmc.rfind_all_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn rfind_first_in<T: BMCharacterSearchable>(&self, text: T) -> Option<usize>[src]

Find and return the position of the first matched sub-sequence in any text (the haystack) from its tail to its head.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(Some(7), bmc.rfind_first_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o']));

pub fn rfind_in<T: BMCharacterSearchable>(
    &self,
    text: T,
    limit: usize
) -> Vec<usize>
[src]

Find and return the positions of matched sub-sequences in any text (the haystack) but not including the overlap from its tail to its head. If the limit is set to 0, all sub-sequences will be found.

extern crate boyer_moore_magiclen;

use boyer_moore_magiclen::BMCharacter;

let bmc = BMCharacter::from(vec!['o', 'o', 'c', 'o', 'o']).unwrap();

assert_eq!(vec![7], bmc.rfind_in(vec!['c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o', 'c', 'o', 'o'], 1));

Trait Implementations

impl Debug for BMCharacter[src]

Auto Trait Implementations

impl Send for BMCharacter

impl Sync for BMCharacter

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]