Add From BytesInput trait for Vec<u8> (#1135)

* Allow take the ownership of the BytesInput

* Add must_use as told

* Implement From&Into for better interoperability

* Format code

* Remove into_bytes

* Remove From<&BytesInput> to avoid misuse
This commit is contained in:
lazymio 2023-03-09 02:12:09 +01:00 committed by GitHub
parent 4d778dd64d
commit b72bf55555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,6 +102,12 @@ impl From<&[u8]> for BytesInput {
}
}
impl From<BytesInput> for Vec<u8> {
fn from(value: BytesInput) -> Vec<u8> {
value.bytes
}
}
impl BytesInput {
/// Creates a new bytes input using the given bytes
#[must_use]