Skip to content

Commit 8951ec1

Browse files
committed
TextSized is not meant to be used directly...
so rename it to a name more distinct from TextSize.
1 parent cf9e29e commit 8951ec1

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod traits;
1212
#[cfg(feature = "serde")]
1313
mod serde_impls;
1414

15-
pub use crate::{range::TextRange, size::TextSize, traits::TextSized};
15+
pub use crate::{range::TextRange, size::TextSize, traits::LenTextSize};
1616

1717
#[cfg(target_pointer_width = "16")]
1818
compile_error!("text-size assumes usize >= u32 and does not work on 16-bit targets");

src/size.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use {
2-
crate::TextSized,
2+
crate::LenTextSize,
33
std::{
44
convert::TryFrom,
55
fmt, iter,
@@ -42,8 +42,8 @@ impl fmt::Debug for TextSize {
4242
impl TextSize {
4343
/// The text size of some text-like object.
4444
#[inline]
45-
pub fn of(text: impl TextSized) -> TextSize {
46-
text.text_size()
45+
pub fn of(text: impl LenTextSize) -> TextSize {
46+
text.len_text_size()
4747
}
4848

4949
/// A size of zero.

src/traits.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@ use {
44
};
55

66
/// Text-like structures that have a text size.
7-
pub trait TextSized: Copy {
7+
pub trait LenTextSize: Copy {
88
/// The size of this text-alike.
9-
fn text_size(self) -> TextSize;
9+
fn len_text_size(self) -> TextSize;
1010
}
1111

12-
impl TextSized for &'_ str {
12+
impl LenTextSize for &'_ str {
1313
#[inline]
14-
fn text_size(self) -> TextSize {
14+
fn len_text_size(self) -> TextSize {
1515
self.len()
1616
.try_into()
1717
.unwrap_or_else(|_| panic!("string too large ({}) for TextSize", self.len()))
1818
}
1919
}
2020

21-
impl<D> TextSized for &'_ D
21+
impl<D> LenTextSize for &'_ D
2222
where
2323
D: Deref<Target = str>,
2424
{
2525
#[inline]
26-
fn text_size(self) -> TextSize {
27-
self.deref().text_size()
26+
fn len_text_size(self) -> TextSize {
27+
self.deref().len_text_size()
2828
}
2929
}
3030

31-
impl TextSized for char {
31+
impl LenTextSize for char {
3232
#[inline]
33-
fn text_size(self) -> TextSize {
33+
fn len_text_size(self) -> TextSize {
3434
(self.len_utf8() as u32).into()
3535
}
3636
}

0 commit comments

Comments
 (0)