1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#![forbid(unsafe_code)]
#![deny(
clippy::dbg_macro,
missing_copy_implementations,
rustdoc::missing_crate_level_docs,
missing_debug_implementations,
nonstandard_style,
unused_qualifications
)]
#![warn(missing_docs)]
//! # Routefinder
//!
//! ```rust
//! use routefinder::{Router, Captures};
//! # pub fn main() -> Result<(), String> {
//! let mut router = Router::new();
//! router.add("/*", 1)?;
//! router.add("/hello", 2)?;
//! router.add("/:greeting", 3)?;
//! router.add("/hey/:world", 4)?;
//! router.add("/hey/earth", 5)?;
//! router.add("/:greeting/:world/*", 6)?;
//!
//! assert_eq!(*router.best_match("/hey/earth").unwrap(), 5);
//! assert_eq!(
//! router.best_match("/hey/mars").unwrap().captures().get("world"),
//! Some("mars")
//! );
//! assert_eq!(router.matches("/hello").len(), 3);
//! assert_eq!(router.matches("/").len(), 1);
//! assert_eq!(
//! router.best_match("/yo/planet/check/this/out").unwrap().captures().wildcard().unwrap(),
//! "check/this/out",
//! );
//!
//! # Ok(()) }
//! ```
//!
//! Check out [`Router`] for a good starting place
//!
mod captures;
pub use captures::{Capture, Captures};
mod r#match;
pub use r#match::Match;
mod router;
pub use router::Router;
mod segment;
pub use segment::Segment;
mod reverse_match;
pub use reverse_match::ReverseMatch;
mod route_spec;
pub use route_spec::RouteSpec;