pub fn parse_typestr(typestr: &str) -> Result<(char, usize), ArrayProtocolError>Expand description
Parse a NumPy type-string into (kind_char, byte_count).
NumPy typestrings have the format <endian><kind><bytes>, where:
- endianness:
'<'(little),'>'(big),'='(native),'|'(n/a) - kind:
'f'float,'i'signed int,'u'unsigned int,'b'bool,'c'complex, etc. - bytes: decimal byte count, e.g.
8for 64-bit.
Returns (kind, byte_count).
ยงExamples
use scirs2_numpy::array_protocol::parse_typestr;
let (kind, bytes) = parse_typestr("<f8").unwrap();
assert_eq!(kind, 'f');
assert_eq!(bytes, 8);