We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 220b99b commit 02720a4Copy full SHA for 02720a4
src/libcore/str.rs
@@ -1277,14 +1277,19 @@ pub mod traits {
1277
}
1278
1279
/// Any string that can be represented as a slice
1280
-pub trait Str {
+pub trait Str for Sized? {
1281
/// Work with `self` as a slice.
1282
fn as_slice<'a>(&'a self) -> &'a str;
1283
1284
1285
-impl<'a> Str for &'a str {
+impl Str for str {
1286
#[inline]
1287
- fn as_slice<'a>(&'a self) -> &'a str { *self }
+ fn as_slice<'a>(&'a self) -> &'a str { self }
1288
+}
1289
+
1290
+impl<'a, Sized? S> Str for &'a S where S: Str {
1291
+ #[inline]
1292
+ fn as_slice(&self) -> &str { Str::as_slice(*self) }
1293
1294
1295
/// Methods for string slices
0 commit comments