path2regex/
lib.rs

1#![forbid(unsafe_code)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![deny(private_in_public, unreachable_pub, missing_docs, rust_2018_idioms)]
4#![doc = include_str!("../README.md")]
5
6mod ast;
7#[cfg(feature = "compile")]
8#[cfg_attr(docsrs, doc(cfg(feature = "compile")))]
9mod compiler;
10#[cfg(feature = "match")]
11#[cfg_attr(docsrs, doc(cfg(feature = "match")))]
12mod matcher;
13mod parser;
14mod re;
15mod try_into_with;
16
17pub use ast::{Key, Token};
18pub use parser::{Parser, ParserBuilder, ParserOptions};
19pub use re::{PathRegex, PathRegexBuilder, PathRegexOptions};
20pub use try_into_with::TryIntoWith;
21
22#[cfg(feature = "compile")]
23pub use compiler::{Compiler, CompilerBuilder, CompilerOptions};
24#[cfg(feature = "match")]
25pub use matcher::{MatchResult, Matcher, MatcherBuilder, MatcherOptions};
26/// The matching trailing character is used for 'end' and 'ends_with' configuration item filtering
27pub const DEFAULT_DELIMITER: &str = "/#?";
28
29mod internal {
30    pub(crate) use regex::escape as escape_string;
31    #[cfg(any(feature = "compile", feature = "match"))]
32    pub(crate) use serde_json::Value as DataValue;
33
34    #[inline]
35    pub(crate) fn type_of<T>(_: T) -> String {
36        std::any::type_name::<T>().to_string()
37    }
38
39    pub(crate) type FnStr = for<'a> fn(&'a str) -> String;
40    #[cfg(any(feature = "compile", feature = "match"))]
41    pub(crate) type FnStrWithKey = for<'a> fn(&'a str, &'a crate::Key) -> String;
42
43    pub(crate) const END_WITH_DELIMITER: &str = "END_WITH_DELIMITER";
44}