File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ pub fn state() -> TimerState {
119119/// So you need to be careful when using this value for indexing.
120120/// Same index does not imply same split on undo and then split.
121121pub fn current_split_index ( ) -> Option < u64 > {
122+ // SAFETY: It is always safe to call this function.
122123 let i = unsafe { sys:: timer_current_split_index ( ) } ;
123124 if i. is_negative ( ) {
124125 return None ;
@@ -132,6 +133,10 @@ pub fn current_split_index() -> Option<u64> {
132133/// If `idx` is greater than or equal to the current split index,
133134/// `None` is returned instead.
134135pub fn segment_splitted ( idx : u64 ) -> Option < bool > {
136+ // SAFETY: It is always safe to call this function.
137+ // Even when `idx` is out of bounds,
138+ // timer_segment_splitted returns `-1`,
139+ // and then segment_splitted returns `None`.
135140 match unsafe { sys:: timer_segment_splitted ( idx) } {
136141 1 => Some ( true ) ,
137142 0 => Some ( false ) ,
You can’t perform that action at this time.
0 commit comments