MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / build_func_params_and_args

Function build_func_params_and_args

crates/codegen/src/csharp.rs:1565–1586  ·  view source on GitHub ↗

Builds C# function parameter and argument lists from an iterator of parameter names and types.

(module: &ModuleDef, params_iter: I, namespace: &str)

Source from the content-addressed store, hash-verified

1563
1564/// Builds C# function parameter and argument lists from an iterator of parameter names and types.
1565fn build_func_params_and_args<'a, I>(module: &ModuleDef, params_iter: I, namespace: &str) -> (String, String)
1566where
1567 I: Iterator<Item = &'a (Identifier, AlgebraicTypeUse)>,
1568{
1569 let mut func_params = String::new();
1570 let mut func_args = String::new();
1571
1572 for (arg_i, (arg_name, arg_ty)) in params_iter.enumerate() {
1573 if arg_i != 0 {
1574 func_params.push_str(", ");
1575 func_args.push_str(", ");
1576 }
1577
1578 let arg_type_str = ty_fmt_with_ns(module, arg_ty, namespace);
1579 let arg_name = arg_name.deref().to_case(Case::Camel);
1580
1581 write!(func_params, "{arg_type_str} {arg_name}").unwrap();
1582 write!(func_args, "{arg_name}").unwrap();
1583 }
1584
1585 (func_params, func_args)
1586}

Callers 2

generate_reducer_fileMethod · 0.85

Calls 5

ty_fmt_with_nsFunction · 0.85
to_caseMethod · 0.80
newFunction · 0.50
derefMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…