I am writing a grammer defined as a bTreeMap, the key is the token and the value is a GrammerDefinition struct. The struct in question stores metadata about a specific token, such as the error name, rules about what is allowed to follow a token and so on. I want to be able to optionally set a callback to handle errors and rules of said metadata. Is this the most optimal pattern and how might this look in code? Any help would be greatly appreciated, I have been googling for around a month.