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

Function split_entity_name

cranelift/reader/src/lexer.rs:110–117  ·  view source on GitHub ↗

Pre-parse a supposed entity name by splitting it into two parts: A head of lowercase ASCII letters and numeric tail.

(name: &str)

Source from the content-addressed store, hash-verified

108/// Pre-parse a supposed entity name by splitting it into two parts: A head of lowercase ASCII
109/// letters and numeric tail.
110pub fn split_entity_name(name: &str) -> Option<(&str, u32)> {
111 let (head, tail) = name.split_at(name.len() - trailing_digits(name));
112 if tail.len() > 1 && tail.starts_with('0') {
113 None
114 } else {
115 tail.parse().ok().map(|n| (head, n))
116 }
117}
118
119/// Lexical analysis.
120///

Callers 2

scan_wordMethod · 0.85
lookup_strMethod · 0.85

Calls 5

trailing_digitsFunction · 0.85
lenMethod · 0.45
mapMethod · 0.45
okMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected