[][src]Struct sub_strs::Globs

pub struct Globs<'a> { /* fields omitted */ }

Globs

This struct contains a set of Glob's.

Methods

impl<'a> Globs<'a>[src]

pub fn from<I>(strs: I) -> Option<Self> where
    I: Iterator<Item = Cow<'a, str>>, 
[src]

Makes new instance from an iterator of Cow<'a, str>

Notes

  • Empty strings will be ignored.
  • If the iterator contains no globs, None is returned.

Examples

use sub_strs::Globs;

let globs = Globs::from("*.rs|*.md".split('|').map(|s| s.into())).unwrap();
assert!(globs.any("this.rs"));
assert!(globs.any("that.md"));
assert!(globs.any("not-this") == false);

pub fn merge<I>(iter: I) -> Option<Self> where
    I: Iterator<Item = Self>, 
[src]

Merges an iterator of Globs<'a> into one

If there are no inner Glob's, None is returned.

Examples

use sub_strs::Globs;

let program_args = &["*.svg,*.OGG", "*.md"];
let globs = Globs::merge(
    program_args.iter().filter_map(|s|
        Globs::from(s.to_lowercase().split(',').map(|s| s.to_string().into()))
    )
);
assert!(globs.map(|g| g.any("some.ogg")).unwrap_or(false));

pub fn any<S>(&self, s: S) -> bool where
    S: AsRef<str>, 
[src]

Trait Implementations

impl<'a> PartialEq<Globs<'a>> for Globs<'a>[src]

impl<'a> Eq for Globs<'a>[src]

impl<'a> Debug for Globs<'a>[src]

Auto Trait Implementations

impl<'a> Send for Globs<'a>

impl<'a> Unpin for Globs<'a>

impl<'a> Sync for Globs<'a>

impl<'a> UnwindSafe for Globs<'a>

impl<'a> RefUnwindSafe for Globs<'a>

Blanket Implementations

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

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

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.

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

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

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