We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
encode()
1 parent e58dc4a commit 5ea8b3dCopy full SHA for 5ea8b3d
src/lib.rs
@@ -3271,7 +3271,14 @@ impl Encoding {
3271
&'static self,
3272
string: impl Into<Cow<'a, str>>,
3273
) -> (Cow<'a, [u8]>, &'static Encoding, bool) {
3274
- let string = string.into();
+ self.encode_(string.into())
3275
+ }
3276
+
3277
+ /// Non-generic version of `encode`, to avoid monomorphizing a large amount of code many times.
3278
+ fn encode_<'a>(
3279
+ &'static self,
3280
+ string: Cow<'a, str>,
3281
+ ) -> (Cow<'a, [u8]>, &'static Encoding, bool) {
3282
let to_cow_bytes = |string: Cow<'a, str>| match string {
3283
Cow::Owned(string) => Cow::Owned(string.into_bytes()),
3284
Cow::Borrowed(str) => Cow::Borrowed(str.as_bytes()),
0 commit comments