MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / arm

Method arm

cranelift/srcgen/src/lib.rs:348–362  ·  view source on GitHub ↗

Add an arm that reads fields to the Match statement.

(&mut self, name: T, fields: Vec<S>, body: T)

Source from the content-addressed store, hash-verified

346
347 /// Add an arm that reads fields to the Match statement.
348 pub fn arm<T: Into<String>, S: Into<String>>(&mut self, name: T, fields: Vec<S>, body: T) {
349 let name = name.into();
350 assert!(
351 name != "_",
352 "catch all clause can't extract fields, use arm_no_fields instead."
353 );
354
355 let body = body.into();
356 let fields = fields.into_iter().map(|x| x.into()).collect();
357 let match_arm = self
358 .arms
359 .entry((fields, body))
360 .or_insert_with(BTreeSet::new);
361 match_arm.insert(name);
362 }
363
364 /// Adds an arm that doesn't read anythings from the fields to the Match statement.
365 pub fn arm_no_fields(&mut self, name: impl Into<String>, body: impl Into<String>) {

Callers 5

adding_arms_worksFunction · 0.80
gen_formatsFunction · 0.80
gen_arguments_methodFunction · 0.80

Calls 6

collectMethod · 0.80
or_insert_withMethod · 0.80
mapMethod · 0.45
into_iterMethod · 0.45
entryMethod · 0.45
insertMethod · 0.45

Tested by 2

adding_arms_worksFunction · 0.64