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

Function snake_to_pascal

crates/openshell-server-macros/src/lib.rs:181–197  ·  view source on GitHub ↗

Convert a Rust snake_case method identifier to the tonic PascalCase gRPC method name (`list_sandboxes` → `ListSandboxes`).

(ident: &str)

Source from the content-addressed store, hash-verified

179/// Convert a Rust snake_case method identifier to the tonic PascalCase
180/// gRPC method name (`list_sandboxes` → `ListSandboxes`).
181fn snake_to_pascal(ident: &str) -> String {
182 let mut out = String::with_capacity(ident.len());
183 let mut upper_next = true;
184 for c in ident.chars() {
185 if c == '_' {
186 upper_next = true;
187 continue;
188 }
189 if upper_next {
190 out.extend(c.to_uppercase());
191 upper_next = false;
192 } else {
193 out.push(c);
194 }
195 }
196 out
197}
198
199/// Name of the per-service const emitted alongside the impl block. The
200/// service module is what disambiguates between services — every impl

Callers

nothing calls this directly

Calls 2

lenMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected