MCPcopy Index your code
hub / github.com/github/copilot-sdk / uniqueRustPascalIdentifier

Function uniqueRustPascalIdentifier

scripts/codegen/rust.ts:112–126  ·  view source on GitHub ↗
(
	value: string,
	used: Set<string>,
	fallback: string,
	reserved: Set<string> = new Set(),
)

Source from the content-addressed store, hash-verified

110}
111
112function uniqueRustPascalIdentifier(
113 value: string,
114 used: Set<string>,
115 fallback: string,
116 reserved: Set<string> = new Set(),
117): string {
118 const identifier = toRustPascalIdentifier(value, fallback);
119 if (used.has(identifier) || reserved.has(identifier)) {
120 throw new Error(
121 `Generated Rust enum variant identifier "${identifier}" is not unique for value "${value}". Add an explicit naming rule instead of stabilizing an arbitrary public variant name.`,
122 );
123 }
124 used.add(identifier);
125 return identifier;
126}
127
128function toSnakeCase(s: string): string {
129 return s

Callers 2

tryEmitRustUnionFunction · 0.85
emitRustStringEnumFunction · 0.85

Calls 2

toRustPascalIdentifierFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…