@@ -63,7 +63,7 @@ extern "C" {
6363/// let values = [2.0f32, 5.0, 6.0];
6464/// let arr = Array::new(&values, dims);
6565///
66- /// let mut idxr = Indexer::new ();
66+ /// let mut idxr = Indexer::default ();
6767///
6868/// // `idx` is created much before idxr, thus will
6969/// // stay in scope at least as long as idxr
@@ -107,6 +107,13 @@ pub struct Indexer<'object> {
107107pub trait Indexable {
108108 /// Set indexing object for a given dimension
109109 ///
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+ ///
110117 /// # Parameters
111118 ///
112119 /// - `idxr` is mutable reference to [Indexer](./struct.Indexer.html) object which will
@@ -146,7 +153,10 @@ where
146153 idxr. get ( ) as AfIndex ,
147154 & SeqInternal :: from_seq ( self ) as * const SeqInternal ,
148155 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+ } ,
150160 ) ;
151161 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
152162 }
@@ -527,7 +537,7 @@ where
527537/// // 0.5328 0.9347 0.0535
528538///
529539///
530- /// let mut idxrs = Indexer::new ();
540+ /// let mut idxrs = Indexer::default ();
531541/// idxrs.set_index(&indices, 0, None); // 2nd parameter is indexing dimension
532542/// idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd parameter indicates batch operation
533543///
@@ -574,7 +584,7 @@ where
574584///
575585/// let b = constant(2.0 as f32, Dim4::new(&[3, 3, 1, 1]));
576586///
577- /// let mut idxrs = Indexer::new ();
587+ /// let mut idxrs = Indexer::default ();
578588/// idxrs.set_index(&indices, 0, None); // 2nd parameter is indexing dimension
579589/// idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd parameter indicates batch operation
580590///
0 commit comments