MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / utf8_len

Function utf8_len

std/json/src/main/tokenizer.rs:177–183  ·  view source on GitHub ↗
(b: u8)

Source from the content-addressed store, hash-verified

175}
176
177fn utf8_len(b: u8) -> Option<usize> {
178 if b < 0x80 { Some(1) }
179 else if b & 0xE0 == 0xC0 { Some(2) }
180 else if b & 0xF0 == 0xE0 { Some(3) }
181 else if b & 0xF8 == 0xF0 { Some(4) }
182 else { None }
183}

Callers 1

read_stringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected