Skip to content

Commit a9c7768

Browse files
committed
impl From<Cursor> for CCursor {
1 parent 4b88798 commit a9c7768

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

crates/epaint/src/text/cursor.rs

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub struct CCursor {
1717
}
1818

1919
impl CCursor {
20+
#[inline]
2021
pub fn new(index: usize) -> Self {
2122
Self {
2223
index,
@@ -25,9 +26,17 @@ impl CCursor {
2526
}
2627
}
2728

29+
impl From<Cursor> for CCursor {
30+
#[inline]
31+
fn from(c: Cursor) -> Self {
32+
c.ccursor
33+
}
34+
}
35+
2836
/// Two `CCursor`s are considered equal if they refer to the same character boundary,
2937
/// even if one prefers the start of the next row.
3038
impl PartialEq for CCursor {
39+
#[inline]
3140
fn eq(&self, other: &Self) -> bool {
3241
self.index == other.index
3342
}
@@ -106,6 +115,7 @@ pub struct PCursor {
106115
/// Two `PCursor`s are considered equal if they refer to the same character boundary,
107116
/// even if one prefers the start of the next row.
108117
impl PartialEq for PCursor {
118+
#[inline]
109119
fn eq(&self, other: &Self) -> bool {
110120
self.paragraph == other.paragraph && self.offset == other.offset
111121
}

0 commit comments

Comments
 (0)