Skip to content

Commit bea015b

Browse files
author
pradeep
committed
Temporary work around in Indexer example snippet for OSX
This issue doesn't happen on Windows and Linux. Creating an Array from `&[]` directly instead of creating a vector first and then borrowing a slice is causing crash on OSX platform.
1 parent 6b0dec7 commit bea015b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/index.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ extern {
3838
/// // that we intend to use for indexing via `Indexer` have to outlive
3939
/// // the `Indexer` object created in this context.
4040
///
41-
/// let dims = Dim4::new(&[1, 3, 1, 1]);
42-
/// let bools = Array::new(&[1.0f32, 0.0, 1.0], dims);
43-
/// let values = Array::new(&[2.0f32, 5.0, 6.0], dims);
41+
/// let dims = Dim4::new(&[1, 3, 1, 1]);
42+
/// let indices = [1u8, 0, 1];
43+
/// let idx = Array::new(&indices, dims);
44+
/// let values = [2.0f32, 5.0, 6.0];
45+
/// let arr = Array::new(&values, dims);
4446
///
4547
/// let mut idxr = Indexer::new();
4648
///
47-
/// // `bools` is created much before idxr, thus will
49+
/// // `idx` is created much before idxr, thus will
4850
/// // stay in scope at least as long as idxr
49-
/// idxr.set_index(&bools, 0, None);
51+
/// idxr.set_index(&idx, 0, None);
5052
///
51-
/// index_gen(&values, idxr);
53+
/// index_gen(&arr, idxr);
5254
/// ```
5355
///
5456
/// <h3> Incorrect Usage </h3>

0 commit comments

Comments
 (0)