pub fn partition(self) -> (PathBuf, Self) {
        let Glob { tokenized, .. } = self;
        let (prefix, tokenized) = tokenized.partition();
        let regex = Glob::compile(tokenized.tokens()).expect("failed to compile partitioned glob");
        (prefix, Glob { tokenized, regex })
    }
/// Partitions a [`Glob`] into an invariant [`PathBuf`] prefix and variant
/// [`Glob`] postfix.
///
/// The invariant prefix contains no glob patterns nor other variant
/// components and therefore can be interpreted as a native path. The
/// [`Glob`] postfix is variant and contains the remaining components that
/// follow the prefix. For example, the glob expression `.local/**/*.log`
/// would produce the path `.local` and glob `**/*.log`. It is possible for
/// either partition to be empty.
///
/// Literal components may be considered variant if they contain characters
/// with casing and the configured case sensitivity differs from the target
/// platform's file system. For example, the case-insensitive literal
/// expression `(?i)photos` is considered variant on Unix and invariant on
/// Windows, because the literal `photos` resolves differently in Unix file
/// system APIs.
///
/// Partitioning a [`Glob`] allows any invariant prefix to be used as a
/// native path to establish a working directory or to interpret semantic
/// components that are not recognized by globs, such as parent directory
/// `..` components.
///
/// Partitioned [`Glob`]s are never rooted. If the glob expression has a
/// root component, then it is always included in the invariant [`PathBuf`]
/// prefix.
///
/// # Examples
///
/// To match paths against a [`Glob`] while respecting semantic components,
/// the invariant prefix and candidate path can be canonicalized. The
/// following example canonicalizes both the working directory joined with
/// the prefix as well as the candidate path and then attempts to match the
/// [`Glob`] if the candidate path contains the prefix.
///
/// ```rust,no_run
/// use dunce; // Avoids UNC paths on Windows.
/// use std::path::Path;
/// use wax::{Glob, Pattern};
///
/// let path: &Path = /* ... */ // Candidate path.
/// # Path::new("");
///
/// let directory = Path::new("."); // Working directory.
/// let (prefix, glob) = Glob::new("../../src/**").unwrap().partition();
/// let prefix = dunce::canonicalize(directory.join(&prefix)).unwrap();
/// if dunce::canonicalize(path)
///     .unwrap()
///     .strip_prefix(&prefix)
///     .map(|path| glob.is_match(path))
///     .unwrap_or(false)
/// {
///     // ...
/// }
/// ```
///
/// [`Glob`]: crate::Glob
/// [`ParseError`]: crate::ParseError
/// [`PathBuf`]: std::path::PathBuf
/// [`RuleError`]: crate::RuleError
/// [`walk`]: crate::Glob::walk


The invariant prefix contains no glob patterns nor other variant
components and therefore can be interpreted as a native path. The
[`Glob`] postfix is variant and contains the remaining components that
follow the prefix.

Literal components may be considered variant if they contain characters
with casing and the configured case sensitivity differs from the target
platform's file system. For example, the case-insensitive literal
expression `(?i)photos` is considered variant on Unix and invariant on
Windows, because the literal `photos` resolves differently in Unix file
system APIs.

Partitioning a [`Glob`] allows any invariant prefix to be used as a
native path to establish a working directory or to interpret semantic
components that are not recognized by globs, such as parent directory
`..` components.

Partitioned [`Glob`]s are never rooted. If the glob expression has a
root component, then it is always included in the invariant [`PathBuf`]
prefix.
The invariant prefix contains no glob patterns nor other variant components and therefore can be interpreted as a native path . The [ ` Glob ` ] postfix is variant and contains the remaining components that follow the prefix . Literal components may be considered variant if they contain characters with casing and the configured case sensitivity differs from the target platform ' s file system . For example the case - insensitive literal expression ` ( ?i ) photos ` is considered variant on Unix and invariant on Windows because the literal ` photos ` resolves differently in Unix file system APIs . Partitioning a [ ` Glob ` ] allows any invariant prefix to be used as a native path to establish a working directory or to interpret semantic components that are not recognized by globs such as parent directory ` .. ` components . Partitioned [ ` Glob ` ] s are never rooted . If the glob expression has a root component then it is always included in the invariant [ ` PathBuf ` ] prefix .
pub fn partition(self) -> (PathBuf, Self) {
        let Glob { tokenized, .. } = self;
        let (prefix, tokenized) = tokenized.partition();
        let regex = Glob::compile(tokenized.tokens()).expect("failed to compile partitioned glob");
        (prefix, Glob { tokenized, regex })
    }
pub fn partition ( self ) -> ( PathBuf , Self ) { let Glob { tokenized , .. } = self ; let ( prefix , tokenized ) = tokenized . partition ( ) ; let regex = Glob :: compile ( tokenized . tokens ( ) ) . expect ( " " ) ; ( prefix , Glob { tokenized , regex } ) }
Partitions a [`Glob`] into an invariant [`PathBuf`] prefix and variant
[`Glob`] postfix.
Partitions a [ ` Glob ` ] into an invariant [ ` PathBuf ` ] prefix and variant [ ` Glob ` ] postfix .
self
self
examples
To match paths against a [`Glob`] while respecting semantic components,
the invariant prefix and candidate path can be canonicalized. The
following example canonicalizes both the working directory joined with
the prefix as well as the candidate path and then attempts to match the
[`Glob`] if the candidate path contains the prefix.

```rust,no_run
use dunce; // Avoids UNC paths on Windows.
use std::path::Path;
use wax::{Glob, Pattern}.

let path: &Path =  ... */ // Candidate path.
To match paths against a [ ` Glob ` ] while respecting semantic components the invariant prefix and candidate path can be canonicalized . The following example canonicalizes both the working directory joined with the prefix as well as the candidate path and then attempts to match the [ ` Glob ` ] if the candidate path contains the prefix . ` ` ` rust no_run use dunce ; // Avoids UNC paths on Windows . use std :: path :: Path ; use wax :: { Glob Pattern } . let path : &Path = ... * / // Candidate path .
path::new("");
let directory = Path::new("."); // Working directory.
let (prefix, glob) = Glob::new("../../src").unwrap().partition();
let prefix = dunce::canonicalize(directory.join(&prefix)).unwrap();
if dunce::canonicalize(path)
.unwrap()
.strip_prefix(&prefix)
.map(|path| glob.is_match(path))
.unwrap_or(false)
{

}
```

[`Glob`]: crate::Glob
[`ParseError`]: crate::ParseError
[`PathBuf`]: std::path::PathBuf
[`RuleError`]: crate::RuleError
[`walk`]: crate::Glob::walk
let directory = Path :: new ( " . " ) ; // Working directory . let ( prefix glob ) = Glob :: new ( " .. / .. / src " ) . unwrap () . partition () ; let prefix = dunce :: canonicalize ( directory . join ( &prefix )) . unwrap () ; if dunce :: canonicalize ( path ) . unwrap () . strip_prefix ( &prefix ) . map ( |path| glob . is_match ( path )) . unwrap_or ( false ) { } ` ` ` [ ` Glob ` ] : crate :: Glob [ ` ParseError ` ] : crate :: ParseError [ ` PathBuf ` ] : std :: path :: PathBuf [ ` RuleError ` ] : crate :: RuleError [ ` walk ` ] : crate :: Glob :: walk