MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / normalize_openapi_mount

Function normalize_openapi_mount

ra-rpc/src/rocket_helper.rs:642–654  ·  view source on GitHub ↗
(path: Cow<'static, str>)

Source from the content-addressed store, hash-verified

640
641#[cfg(all(feature = "rocket", feature = "openapi"))]
642fn 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"))]
657fn join_mount_path(base: &str, segment: &str) -> String {

Callers 1

mount_openapi_docsFunction · 0.85

Calls 2

is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected