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

Method from_str

cranelift/codegen/src/ir/extfunc.rs:274–289  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

272impl FromStr for ArgumentPurpose {
273 type Err = ();
274 fn from_str(s: &str) -> Result<Self, ()> {
275 match s {
276 "normal" => Ok(Self::Normal),
277 "sret" => Ok(Self::StructReturn),
278 "vmctx" => Ok(Self::VMContext),
279 _ if s.starts_with("sarg(") => {
280 if !s.ends_with(")") {
281 return Err(());
282 }
283 // Parse 'sarg(size)'
284 let size: u32 = s["sarg(".len()..s.len() - 1].parse().map_err(|_| ())?;
285 Ok(Self::StructArgument(size))
286 }
287 _ => Err(()),
288 }
289 }
290}
291
292/// An external function.

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
parseMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected