File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 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);
11501150// have been unsuccessful
11511151
11521152impl Pos for BytePos {
1153+ #[ inline( always) ]
11531154 fn from_usize ( n : usize ) -> BytePos { BytePos ( n as u32 ) }
1155+
1156+ #[ inline( always) ]
11541157 fn to_usize ( & self ) -> usize { let BytePos ( n) = * self ; n as usize }
11551158}
11561159
11571160impl Add for BytePos {
11581161 type Output = BytePos ;
11591162
1163+ #[ inline( always) ]
11601164 fn add ( self , rhs : BytePos ) -> BytePos {
11611165 BytePos ( ( self . to_usize ( ) + rhs. to_usize ( ) ) as u32 )
11621166 }
@@ -1165,6 +1169,7 @@ impl Add for BytePos {
11651169impl Sub for BytePos {
11661170 type Output = BytePos ;
11671171
1172+ #[ inline( always) ]
11681173 fn sub ( self , rhs : BytePos ) -> BytePos {
11691174 BytePos ( ( self . to_usize ( ) - rhs. to_usize ( ) ) as u32 )
11701175 }
@@ -1183,13 +1188,17 @@ impl Decodable for BytePos {
11831188}
11841189
11851190impl Pos for CharPos {
1191+ #[ inline( always) ]
11861192 fn from_usize ( n : usize ) -> CharPos { CharPos ( n) }
1193+
1194+ #[ inline( always) ]
11871195 fn to_usize ( & self ) -> usize { let CharPos ( n) = * self ; n }
11881196}
11891197
11901198impl Add for CharPos {
11911199 type Output = CharPos ;
11921200
1201+ #[ inline( always) ]
11931202 fn add ( self , rhs : CharPos ) -> CharPos {
11941203 CharPos ( self . to_usize ( ) + rhs. to_usize ( ) )
11951204 }
@@ -1198,6 +1207,7 @@ impl Add for CharPos {
11981207impl Sub for CharPos {
11991208 type Output = CharPos ;
12001209
1210+ #[ inline( always) ]
12011211 fn sub ( self , rhs : CharPos ) -> CharPos {
12021212 CharPos ( self . to_usize ( ) - rhs. to_usize ( ) )
12031213 }
You can’t perform that action at this time.
0 commit comments