MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / variant_new_func_name

Function variant_new_func_name

crates/csharp/src/interface.rs:1982–1988  ·  view source on GitHub ↗

Handles the tag being the same name as the variant, which would cause a method with the same name as the type in C# which is not valid.

(variant_name: &String, tag: &String)

Source from the content-addressed store, hash-verified

1980
1981// Handles the tag being the same name as the variant, which would cause a method with the same name as the type in C# which is not valid.
1982pub fn variant_new_func_name(variant_name: &String, tag: &String) -> String {
1983 if *tag == *variant_name {
1984 format!("{tag}_") // Underscores are not valid in wit identifiers so this should be safe.
1985 } else {
1986 tag.clone()
1987 }
1988}
1989
1990#[derive(Copy, Clone, PartialEq, Eq, Debug)]
1991pub(crate) enum ParameterType {

Callers 2

type_variantMethod · 0.85
lift_variantMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected