Enum patmatch::Chunk[][src]

pub enum Chunk {
    Str(String),
    Wildcard,
    UnknownChar,
}

A part of a Pattern. Used to configure a compiled Pattern.

Variants

Str(String)

A literal string. This matches the string exactly.

Wildcard

A wildcard (usually represented by an asterisk). Matches any amount of characters, including none.

UnknownChar

An unknown character (usually represented by a question mark).

Implementations

impl Chunk[src]

pub fn str(s: &str) -> Chunk[src]

Trait Implementations

impl Clone for Chunk[src]

impl Debug for Chunk[src]

impl Eq for Chunk[src]

impl From<String> for Chunk[src]

impl FromIterator<Chunk> for Pattern[src]

fn from_iter<T: IntoIterator<Item = Chunk>>(iter: T) -> Self[src]

Used to compile a Pattern from an iterator of Chunks. Note that this allocates memory to store all the Chunks.

Example usage:

use patmatch::{Pattern, Chunk};
let chunk_vec = vec![Chunk::str("IMG_"), Chunk::Wildcard, Chunk::str(".png")];
let pat: Pattern = chunk_vec.into_iter().collect();
assert!(pat.matches("IMG_20170301.png"));
assert!(!pat.matches("stuff.png")); assert!(!pat.matches("IMG_20170302.jpeg"));

impl PartialEq<Chunk> for Chunk[src]

impl StructuralEq for Chunk[src]

impl StructuralPartialEq for Chunk[src]

Auto Trait Implementations

impl RefUnwindSafe for Chunk

impl Send for Chunk

impl Sync for Chunk

impl Unpin for Chunk

impl UnwindSafe for Chunk

Blanket Implementations

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

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

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

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.