(path: Cow<'static, str>)
| 640 | |
| 641 | #[cfg(all(feature = "rocket", feature = "openapi"))] |
| 642 | fn normalize_openapi_mount(path: Cow<'static, str>) -> Cow<'static, str> { |
| 643 | let mut owned = path.into_owned(); |
| 644 | if owned.is_empty() { |
| 645 | owned.push('/'); |
| 646 | } |
| 647 | if !owned.starts_with('/') { |
| 648 | owned.insert(0, '/'); |
| 649 | } |
| 650 | if owned.len() > 1 && owned.ends_with('/') { |
| 651 | owned.pop(); |
| 652 | } |
| 653 | Cow::Owned(if owned.is_empty() { "/".into() } else { owned }) |
| 654 | } |
| 655 | |
| 656 | #[cfg(all(feature = "rocket", feature = "openapi"))] |
| 657 | fn join_mount_path(base: &str, segment: &str) -> String { |
no test coverage detected