MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / parse_auth_mode

Function parse_auth_mode

crates/openshell-server-macros/src/lib.rs:153–166  ·  view source on GitHub ↗
(value: &LitStr)

Source from the content-addressed store, hash-verified

151}
152
153fn parse_auth_mode(value: &LitStr) -> Result<AuthMode> {
154 match value.value().as_str() {
155 "unauthenticated" => Ok(AuthMode::Unauthenticated),
156 "sandbox" => Ok(AuthMode::Sandbox),
157 "bearer" => Ok(AuthMode::Bearer),
158 "dual" => Ok(AuthMode::Dual),
159 other => Err(Error::new(
160 value.span(),
161 format!(
162 "invalid auth mode `{other}`; expected one of `unauthenticated`, `sandbox`, `bearer`, `dual`"
163 ),
164 )),
165 }
166}
167
168fn parse_role(value: &LitStr) -> Result<RoleLit> {
169 match value.value().as_str() {

Callers 1

parseMethod · 0.85

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected