Converting BStr/BString to std::String #172
-
|
I think this is a common use case. I can't find anything in the documentation. How is this done? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Lines 264 to 271 in ec2154a (Why is documentation not mentioning this? :( ) |
Beta Was this translation helpful? Give feedback.
-
|
A A There are also |
Beta Was this translation helpful? Give feedback.
A
BStrcan be converted to a&strviaByteSlice::to_str. It's one of the first methods listed on the trait. And ifsis a&str, you can get aStringvias.to_string().A
BStringcan be converted to aStringviaByteVec::into_string.There are also
TryFromimpls forTryFrom<&BString> for &strandTryFrom<BString> for String. Analogously, there is alsoTryFrom<&BStr> for &strandTryFrom<&BStr> for String.