pub fn any<'t, P, I>(patterns: I) -> Result<Any<'t>, BuildError<'t>>
where
    BuildError<'t>: From<<I::Item as TryInto<P>>::Error>,
    P: Pattern<'t>,
    I: IntoIterator,
    I::Item: TryInto<P>,
{
    let tokens = patterns
        .into_iter()
        .map(TryInto::try_into)
        .map_ok(|pattern| {
            pattern
                .into_tokens()
                .into_iter()
                .map(Token::unannotate)
                .collect::<Vec<_>>()
        })
        .collect::<Result<Vec<_>, _>>()?;
    let token = token::any(tokens);
    let regex = Any::compile(&token)?;
    Ok(Any { token, regex })
}
// TODO: It may be useful to use dynamic dispatch via `dyn Pattern` and an
//       object safe `ToTokens` trait instead. This allows for a variety of
//       types to be combined in an `any` call and would be especially useful if
//       additional combinators are introduced (namely a `Not` combinator, as
//       `All` is a bit odd and not very useful in this context.
/// Combinator that emits a [`Pattern`] that matches if any of its input
/// [`Pattern`]s match.
///
/// This function accepts an [`IntoIterator`] with items that can be converted
/// into a [`Pattern`] type. The output [`Any`] implements [`Pattern`] by
/// matching any of its component [`Pattern`]s. [`Any`] is often more ergonomic
/// and efficient than matching against multiple [`Glob`]s or other
/// [`Pattern`]s.
///
/// [`Any`] groups all captures and therefore only exposes the complete text of
/// a match. It is not possible to index a particular capturing token in the
/// component patterns.
///
/// # Examples
///
/// To match a path against multiple patterns, the patterns can first be
/// combined into an [`Any`].
///
/// ```rust
/// use wax::{Glob, Pattern};
///
/// let any = wax::any::<Glob, _>([
///     "src/**/*.rs",
///     "tests/**/*.rs",
///     "doc/**/*.md",
///     "pkg/**/PKGBUILD",
/// ])
/// .unwrap();
/// if any.is_match("src/lib.rs") { /* ... */ }
/// ```
///
/// Opaque patterns can also be combined, such as [`Glob`]s from foreign code.
///
/// ```rust
/// use wax::{BuildError, Glob, Pattern};
///
/// fn theirs() -> Result<Glob<'static>, BuildError<'static>> {
///     /* ... */
///     # Glob::new("")
/// }
///
/// let theirs = theirs().unwrap();
/// let mine = Glob::new("**/*.txt").unwrap();
/// if wax::any::<Glob, _>([theirs, mine])
///     .unwrap()
///     .is_match("README.md")
/// { /* ... */ }
/// ```
///
/// # Errors
///
/// Returns an error if any of the inputs fail to build into the target
/// [`Pattern`] type `P`. If the inputs are of type `P`, then this function is
/// infallible.
///
/// [`Any`]: crate::Any
/// [`Glob`]: crate::Glob
/// [`IntoIterator`]: std::iter::IntoIterator
/// [`Pattern`]: crate::Pattern
It may be useful to use dynamic dispatch via `dyn Pattern` and an
object safe `ToTokens` trait instead.

This function accepts an [`IntoIterator`] with items that can be converted
into a [`Pattern`] type.

[`Any`] groups all captures and therefore only exposes the complete text of
a match. It is not possible to index a particular capturing token in the
component patterns.
It may be useful to use dynamic dispatch via ` dyn Pattern ` and an object safe ` ToTokens ` trait instead . This function accepts an [ ` IntoIterator ` ] with items that can be converted into a [ ` Pattern ` ] type . [ ` Any ` ] groups all captures and therefore only exposes the complete text of a match . It is not possible to index a particular capturing token in the component patterns .
pub fn any<'t, P, I>(patterns: I) -> Result<Any<'t>, BuildError<'t>>
where
    BuildError<'t>: From<<I::Item as TryInto<P>>::Error>,
    P: Pattern<'t>,
    I: IntoIterator,
    I::Item: TryInto<P>,
{
    let tokens = patterns
        .into_iter()
        .map(TryInto::try_into)
        .map_ok(|pattern| {
            pattern
                .into_tokens()
                .into_iter()
                .map(Token::unannotate)
                .collect::<Vec<_>>()
        })
        .collect::<Result<Vec<_>, _>>()?;
    let token = token::any(tokens);
    let regex = Any::compile(&token)?;
    Ok(Any { token, regex })
}
pub fn any < ' t , P , I > ( patterns : I ) -> Result < Any < ' t > , BuildError < ' t > > where BuildError < ' t > : From < < I :: Item as TryInto < P > > :: Error > , P : Pattern < ' t > , I : IntoIterator , I :: Item : TryInto < P > , { let tokens = patterns . into_iter ( ) . map ( TryInto :: try_into ) . map_ok ( | pattern | { pattern . into_tokens ( ) . into_iter ( ) . map ( Token :: unannotate ) . collect :: < Vec < _ > > ( ) } ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; let token = token :: any ( tokens ) ; let regex = Any :: compile ( & token ) ? ; Ok ( Any { token , regex } ) }
TODO: It may be useful to use dynamic dispatch via `dyn Pattern` and an
object safe `ToTokens` trait instead.
TODO : It may be useful to use dynamic dispatch via ` dyn Pattern ` and an object safe ` ToTokens ` trait instead .
patterns
I
patterns
I
examples
To match a path against multiple patterns, the patterns can first be
combined into an [`Any`].

```rust
use wax::{Glob, Pattern}.



Opaque patterns can also be combined, such as [`Glob`]s from foreign code.

```rust
use wax::{BuildError, Glob, Pattern}.

fn theirs() -> Result, BuildError<'static>> {

Glob::new("")
}

let theirs = theirs().unwrap();
let mine = Glob::new("**.txt").unwrap();
if wax::any::([theirs, mine])
.unwrap()
.is_match("README.md")
{  ...
To match a path against multiple patterns the patterns can first be combined into an [ ` Any ` ] . ` ` ` rust use wax :: { Glob Pattern } . Opaque patterns can also be combined such as [ ` Glob ` ] s from foreign code . ` ` ` rust use wax :: { BuildError Glob Pattern } . fn theirs () - > Result BuildError< ' static >> { Glob :: new ( " " ) } let theirs = theirs () . unwrap () ; let mine = Glob :: new ( " ** . txt " ) . unwrap () ; if wax :: any :: ( [ theirs mine ] ) . unwrap () . is_match ( " README . md " ) { ...
errors
Returns an error if any of the inputs fail to build into the target
[`Pattern`] type `P`. If the inputs are of type `P`, then this function is
infallible.

[`Any`]: crate::Any
[`Glob`]: crate::Glob
[`IntoIterator`]: std::iter::IntoIterator
[`Pattern`]: crate::Pattern
Returns an error if any of the inputs fail to build into the target [ ` Pattern ` ] type ` P ` . If the inputs are of type ` P ` then this function is infallible . [ ` Any ` ] : crate :: Any [ ` Glob ` ] : crate :: Glob [ ` IntoIterator ` ] : std :: iter :: IntoIterator [ ` Pattern ` ] : crate :: Pattern