MCPcopy Index your code
hub / github.com/RustPython/RustPython / parse

Method parse

crates/vm/src/buffer.rs:32–45  ·  view source on GitHub ↗

Parse endianness See also: https://docs.python.org/3/library/struct.html?highlight=struct#byte-order-size-and-alignment

(chars: &mut Peekable<I>)

Source from the content-addressed store, hash-verified

30 /// Parse endianness
31 /// See also: https://docs.python.org/3/library/struct.html?highlight=struct#byte-order-size-and-alignment
32 fn parse<I>(chars: &mut Peekable<I>) -> Self
33 where
34 I: Sized + Iterator<Item = u8>,
35 {
36 let e = match chars.peek() {
37 Some(b'@') => Self::Native,
38 Some(b'=') => Self::Host,
39 Some(b'<') => Self::Little,
40 Some(b'>') | Some(b'!') => Self::Big,
41 _ => return Self::Native,
42 };
43 chars.next().unwrap();
44 e
45 }
46}
47
48trait ByteOrder {

Callers

nothing calls this directly

Calls 15

compensate_alignmentFunction · 0.85
new_struct_errorFunction · 0.85
ok_or_elseMethod · 0.80
okMethod · 0.80
arg_countMethod · 0.80
ErrClass · 0.50
SomeClass · 0.50
parseFunction · 0.50
peekMethod · 0.45
unwrapMethod · 0.45
nextMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected