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
BStr
can be converted to a&str
viaByteSlice::to_str
. It's one of the first methods listed on the trait. And ifs
is a&str
, you can get aString
vias.to_string()
.A
BString
can be converted to aString
viaByteVec::into_string
.There are also
TryFrom
impls forTryFrom<&BString> for &str
andTryFrom<BString> for String
. Analogously, there is alsoTryFrom<&BStr> for &str
andTryFrom<&BStr> for String
.