Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/RustPython/RustPython
/ char_to_decimal
Function
char_to_decimal
crates/common/src/str.rs:646–651 ·
view source on GitHub ↗
(ch: char)
Source
from the content-addressed store, hash-verified
644
];
645
646
pub fn char_to_decimal(ch: char) -> Option<u8> {
647
UNICODE_DECIMAL_VALUES
648
.binary_search(&ch)
649
.ok()
650
.map(|i| (i % 10) as u8)
651
}
652
653
#[cfg(test)]
654
mod tests {
Callers
1
float_from_string
Function · 0.85
Calls
2
ok
Method · 0.80
map
Method · 0.45
Tested by
no test coverage detected