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.
1 parent 246660c commit 63cbf15Copy full SHA for 63cbf15
src/traits.rs
@@ -1,4 +1,7 @@
1
-use {crate::TextSize, std::convert::TryInto};
+use {
2
+ crate::TextSize,
3
+ std::{convert::TryInto, ops::Deref},
4
+};
5
6
/// Text-like structures that have a text size.
7
pub trait TextSized: Copy {
@@ -15,6 +18,17 @@ impl TextSized for &'_ str {
15
18
}
16
19
17
20
21
+impl<D> TextSized for &'_ D
22
+where
23
+ D: Deref,
24
+ for<'a> &'a D::Target: TextSized,
25
+{
26
+ #[inline]
27
+ fn text_size(self) -> TextSize {
28
+ self.deref().text_size()
29
+ }
30
+}
31
+
32
impl TextSized for char {
33
#[inline]
34
fn text_size(self) -> TextSize {
0 commit comments