@@ -63,7 +63,7 @@ extern "C" {
63
63
/// let values = [2.0f32, 5.0, 6.0];
64
64
/// let arr = Array::new(&values, dims);
65
65
///
66
- /// let mut idxr = Indexer::new ();
66
+ /// let mut idxr = Indexer::default ();
67
67
///
68
68
/// // `idx` is created much before idxr, thus will
69
69
/// // stay in scope at least as long as idxr
@@ -107,6 +107,13 @@ pub struct Indexer<'object> {
107
107
pub trait Indexable {
108
108
/// Set indexing object for a given dimension
109
109
///
110
+ /// `is_batch` parameter is not used in most cases as it has been provided in
111
+ /// ArrayFire C-API to enable GFOR construct in ArrayFire C++ API. This type
112
+ /// of construct/idea is not exposed in rust wrapper yet. So, the user would
113
+ /// just need to pass `None` to this parameter while calling this function.
114
+ /// Since we can't have default default values and we wanted to keep this
115
+ /// parameter for future use cases, we just made it an `std::Option`.
116
+ ///
110
117
/// # Parameters
111
118
///
112
119
/// - `idxr` is mutable reference to [Indexer](./struct.Indexer.html) object which will
@@ -146,7 +153,10 @@ where
146
153
idxr. get ( ) as AfIndex ,
147
154
& SeqInternal :: from_seq ( self ) as * const SeqInternal ,
148
155
dim as DimT ,
149
- is_batch. unwrap ( ) as c_int ,
156
+ match is_batch {
157
+ Some ( value) => value as c_int ,
158
+ None => false as c_int ,
159
+ } ,
150
160
) ;
151
161
HANDLE_ERROR ( AfError :: from ( err_val) ) ;
152
162
}
@@ -527,7 +537,7 @@ where
527
537
/// // 0.5328 0.9347 0.0535
528
538
///
529
539
///
530
- /// let mut idxrs = Indexer::new ();
540
+ /// let mut idxrs = Indexer::default ();
531
541
/// idxrs.set_index(&indices, 0, None); // 2nd parameter is indexing dimension
532
542
/// idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd parameter indicates batch operation
533
543
///
@@ -574,7 +584,7 @@ where
574
584
///
575
585
/// let b = constant(2.0 as f32, Dim4::new(&[3, 3, 1, 1]));
576
586
///
577
- /// let mut idxrs = Indexer::new ();
587
+ /// let mut idxrs = Indexer::default ();
578
588
/// idxrs.set_index(&indices, 0, None); // 2nd parameter is indexing dimension
579
589
/// idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd parameter indicates batch operation
580
590
///
0 commit comments