Closed justincpresley closed 3 years ago
Why don't just use get_value()? The following program is supposed to be always true:
bytes(Name.Component.get_value(Name.Component.from_bytes(X))) == X
The outmost bytes
is used because get_value
returns a memoryview
to avoid unnecessary copy.
When transferring bytes into a Component via from_bytes(), there is not a good way to transfer it back since there is no to_bytes() method.
Since the from_bytes() method adds a type and length, it is not a straightforward method to get it back into bytes and does require lots of testing / hardcoding to get a solution that does get it back. I would greatly appreciate adding this method as I am doing work that requires the from_bytes() method to be used.
Thank you.