Render array of bytearrays in tv_output

This commit is contained in:
therealyingtong 2021-05-07 12:27:08 +08:00
parent 48fca9ad62
commit 99feaed0f4
1 changed files with 14 additions and 0 deletions

View File

@ -142,6 +142,20 @@ def tv_part_rust(name, value, config, indent=3):
tv_option_int_rust(name, value, pad)
elif type(value) == int:
tv_int_rust(name, value, pad)
elif type(value) == list:
print('''%s%s: [''' % (
pad,
name,
))
for item in value:
if type(item) == bytes:
print('''%s[%s],''' % (
' ' * (indent + 1),
chunk(hexlify(item)),
))
print('''%s],''' % (
pad,
))
else:
raise ValueError('Invalid type(%s): %s' % (name, type(value)))