@@ -31,9 +31,7 @@ pub fn tsk_column_access<
31
31
tsk_column_access_detail ( row, column, column_length) . map ( |v| v. into ( ) )
32
32
}
33
33
34
- pub fn tsk_ragged_column_access <
35
- ' a ,
36
- O ,
34
+ pub fn tsk_ragged_column_access_detail <
37
35
R : Into < bindings:: tsk_id_t > ,
38
36
L : Into < bindings:: tsk_size_t > ,
39
37
T : Copy ,
@@ -43,7 +41,7 @@ pub fn tsk_ragged_column_access<
43
41
column_length : L ,
44
42
offset : * const bindings:: tsk_size_t ,
45
43
offset_length : bindings:: tsk_size_t ,
46
- ) -> Option < & ' a [ O ] > {
44
+ ) -> Option < ( * const T , usize ) > {
47
45
let row = row. into ( ) ;
48
46
let column_length = column_length. into ( ) ;
49
47
if row < 0 || row as bindings:: tsk_size_t > column_length || offset_length == 0 {
@@ -61,12 +59,29 @@ pub fn tsk_ragged_column_access<
61
59
if start == stop {
62
60
None
63
61
} else {
64
- Some ( unsafe {
65
- std:: slice:: from_raw_parts (
66
- column. offset ( start as isize ) . cast :: < O > ( ) ,
67
- stop as usize - start as usize ,
68
- )
69
- } )
62
+ Some ( (
63
+ unsafe { column. offset ( start as isize ) } ,
64
+ stop as usize - start as usize ,
65
+ ) )
70
66
}
71
67
}
72
68
}
69
+
70
+ pub fn tsk_ragged_column_access <
71
+ ' a ,
72
+ O ,
73
+ R : Into < bindings:: tsk_id_t > ,
74
+ L : Into < bindings:: tsk_size_t > ,
75
+ T : Copy ,
76
+ > (
77
+ row : R ,
78
+ column : * const T ,
79
+ column_length : L ,
80
+ offset : * const bindings:: tsk_size_t ,
81
+ offset_length : bindings:: tsk_size_t ,
82
+ ) -> Option < & ' a [ O ] > {
83
+ match tsk_ragged_column_access_detail ( row, column, column_length, offset, offset_length) {
84
+ Some ( ( p, n) ) => Some ( unsafe { std:: slice:: from_raw_parts ( p. cast :: < O > ( ) , n) } ) ,
85
+ None => None ,
86
+ }
87
+ }
0 commit comments