string icon indicating copy to clipboard operation
string copied to clipboard

Add a conversion from `std::string::String` to `String<Bytes>`

Open argv-minus-one opened this issue 2 years ago • 0 comments

This PR implements From<std::string::String> for String<Bytes>, which otherwise requires unsafe.

No conversion is added for String<BytesMut> because there is no implementation of From<Vec<u8>> or From<std::string::String> for BytesMut, as there is for Bytes.

This is a breaking change, surprisingly enough, as demonstrated by the changed test case test_from_std_string. Now that there is more than one possible conversion of std::string::String to String<_>, the _ must be given explicitly; Rust can't infer it any more.

argv-minus-one avatar Jan 24 '22 00:01 argv-minus-one