File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1150,13 +1150,17 @@ pub struct CharPos(pub usize);
1150
1150
// have been unsuccessful
1151
1151
1152
1152
impl Pos for BytePos {
1153
+ #[ inline( always) ]
1153
1154
fn from_usize ( n : usize ) -> BytePos { BytePos ( n as u32 ) }
1155
+
1156
+ #[ inline( always) ]
1154
1157
fn to_usize ( & self ) -> usize { let BytePos ( n) = * self ; n as usize }
1155
1158
}
1156
1159
1157
1160
impl Add for BytePos {
1158
1161
type Output = BytePos ;
1159
1162
1163
+ #[ inline( always) ]
1160
1164
fn add ( self , rhs : BytePos ) -> BytePos {
1161
1165
BytePos ( ( self . to_usize ( ) + rhs. to_usize ( ) ) as u32 )
1162
1166
}
@@ -1165,6 +1169,7 @@ impl Add for BytePos {
1165
1169
impl Sub for BytePos {
1166
1170
type Output = BytePos ;
1167
1171
1172
+ #[ inline( always) ]
1168
1173
fn sub ( self , rhs : BytePos ) -> BytePos {
1169
1174
BytePos ( ( self . to_usize ( ) - rhs. to_usize ( ) ) as u32 )
1170
1175
}
@@ -1183,13 +1188,17 @@ impl Decodable for BytePos {
1183
1188
}
1184
1189
1185
1190
impl Pos for CharPos {
1191
+ #[ inline( always) ]
1186
1192
fn from_usize ( n : usize ) -> CharPos { CharPos ( n) }
1193
+
1194
+ #[ inline( always) ]
1187
1195
fn to_usize ( & self ) -> usize { let CharPos ( n) = * self ; n }
1188
1196
}
1189
1197
1190
1198
impl Add for CharPos {
1191
1199
type Output = CharPos ;
1192
1200
1201
+ #[ inline( always) ]
1193
1202
fn add ( self , rhs : CharPos ) -> CharPos {
1194
1203
CharPos ( self . to_usize ( ) + rhs. to_usize ( ) )
1195
1204
}
@@ -1198,6 +1207,7 @@ impl Add for CharPos {
1198
1207
impl Sub for CharPos {
1199
1208
type Output = CharPos ;
1200
1209
1210
+ #[ inline( always) ]
1201
1211
fn sub ( self , rhs : CharPos ) -> CharPos {
1202
1212
CharPos ( self . to_usize ( ) - rhs. to_usize ( ) )
1203
1213
}
You can’t perform that action at this time.
0 commit comments