-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
as_ne_bytes for primitive types #64464
Copy link
Copy link
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]
Description
Activity
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]
Recently I've encountered a problem, when I wanted to return a slice of bytes in an integer:
(This is an oversimplification of the original code, which is generic over every integer type along with other stuff)
Obviously, since
to_le_bytes(*num)is dropped when the function returns, this piece of code failed the borrow check. Hence my need foras_le_bytes(num), asnumis actually alive all this time!