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

Function parse_role

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

Source from the content-addressed store, hash-verified

166}
167
168fn parse_role(value: &LitStr) -> Result<RoleLit> {
169 match value.value().as_str() {
170 "admin" => Ok(RoleLit::Admin),
171 "user" => Ok(RoleLit::User),
172 other => Err(Error::new(
173 value.span(),
174 format!("invalid role `{other}`; expected `admin` or `user`"),
175 )),
176 }
177}
178
179/// Convert a Rust snake_case method identifier to the tonic PascalCase
180/// gRPC method name (`list_sandboxes` → `ListSandboxes`).

Callers 1

parseMethod · 0.85

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected