ptth/crates/ptth_core/src/lib.rs

17 lines
366 B
Rust

pub mod graceful_shutdown;
pub mod http_serde;
pub mod prelude;
// The arguments are in order so they are in order overall:
// e.g. prefix_match ("/prefix", "/prefix/middle/suffix") -> "/middle/suffix"
pub fn prefix_match <'a> (prefix: &str, hay: &'a str) -> Option <&'a str>
{
if hay.starts_with (prefix) {
Some (&hay [prefix.len ()..])
}
else {
None
}
}