import re
with open('src/lib.rs', 'r') as f:
content = f.read()
content = re.sub(r'&bytes\[([^\]]+)\]', r'bytes.get(\1).unwrap_or(&[])', content)
content = re.sub(r'bytes\[idx\]', r'*bytes.get(idx).unwrap_or(&0)', content)
content = re.sub(r'&text\[([^\]]+)\]', r'text.get(\1).unwrap_or("")', content)
with open('src/lib.rs', 'w') as f:
f.write(content)