Skip to content

Commit ffe748a

Browse files
committed
Correct doc test annotations
1 parent 6c3e1dc commit ffe748a

File tree

9 files changed

+50
-41
lines changed

9 files changed

+50
-41
lines changed

src/algorithm/mod.rs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ dim_reduce_func_def!("
8282
8383
# Examples
8484
85-
```
85+
```rust
8686
use arrayfire::{Dim4, print, randu, sum};
8787
let dims = Dim4::new(&[5, 3, 1, 1]);
8888
let a = randu::<f32>(dims);
@@ -109,7 +109,7 @@ dim_reduce_func_def!("
109109
110110
# Examples
111111
112-
```
112+
```rust
113113
use arrayfire::{Dim4, print, randu, product};
114114
let dims = Dim4::new(&[5, 3, 1, 1]);
115115
let a = randu::<f32>(dims);
@@ -135,7 +135,7 @@ dim_reduce_func_def!("
135135
136136
# Examples
137137
138-
```
138+
```rust
139139
use arrayfire::{Dim4, print, randu, min};
140140
let dims = Dim4::new(&[5, 3, 1, 1]);
141141
let a = randu::<f32>(dims);
@@ -144,6 +144,7 @@ dim_reduce_func_def!("
144144
print(&b);
145145
let c = min(&a, 1);
146146
print(&c);
147+
```
147148
", min, af_min);
148149

149150
dim_reduce_func_def!("
@@ -160,7 +161,7 @@ dim_reduce_func_def!("
160161
161162
# Examples
162163
163-
```
164+
```rust
164165
use arrayfire::{Dim4, print, randu, max};
165166
let dims = Dim4::new(&[5, 3, 1, 1]);
166167
let a = randu::<f32>(dims);
@@ -169,6 +170,7 @@ dim_reduce_func_def!("
169170
print(&b);
170171
let c = max(&a, 1);
171172
print(&c);
173+
```
172174
", max, af_max);
173175

174176
dim_reduce_func_def!("
@@ -185,7 +187,7 @@ dim_reduce_func_def!("
185187
186188
# Examples
187189
188-
```
190+
```rust
189191
use arrayfire::{Dim4, print, randu, all_true};
190192
let dims = Dim4::new(&[5, 3, 1, 1]);
191193
let a = randu::<f32>(dims);
@@ -194,6 +196,7 @@ dim_reduce_func_def!("
194196
print(&b);
195197
let c = all_true(&a, 1);
196198
print(&c);
199+
```
197200
", all_true, af_all_true);
198201

199202
dim_reduce_func_def!("
@@ -210,7 +213,7 @@ dim_reduce_func_def!("
210213
211214
# Examples
212215
213-
```
216+
```rust
214217
use arrayfire::{Dim4, print, randu, any_true};
215218
let dims = Dim4::new(&[5, 3, 1, 1]);
216219
let a = randu::<f32>(dims);
@@ -219,6 +222,7 @@ dim_reduce_func_def!("
219222
print(&b);
220223
let c = any_true(&a, 1);
221224
print(&c);
225+
```
222226
", any_true, af_any_true);
223227

224228
dim_reduce_func_def!("
@@ -235,7 +239,7 @@ dim_reduce_func_def!("
235239
236240
# Examples
237241
238-
```
242+
```rust
239243
use arrayfire::{Dim4, gt, print, randu, count};
240244
let dims = Dim4::new(&[5, 3, 1, 1]);
241245
let a = gt(&randu::<f32>(dims), &0.5, false);
@@ -244,6 +248,7 @@ dim_reduce_func_def!("
244248
print(&b);
245249
let c = count(&a, 1);
246250
print(&c);
251+
```
247252
", count, af_count);
248253

249254
dim_reduce_func_def!("
@@ -260,7 +265,7 @@ dim_reduce_func_def!("
260265
261266
# Examples
262267
263-
```
268+
```rust
264269
use arrayfire::{Dim4, print, randu, accum};
265270
let dims = Dim4::new(&[5, 3, 1, 1]);
266271
let a = randu::<f32>(dims);
@@ -269,6 +274,7 @@ dim_reduce_func_def!("
269274
print(&b);
270275
let c = accum(&a, 1);
271276
print(&c);
277+
```
272278
", accum, af_accum);
273279

274280
dim_reduce_func_def!("
@@ -285,7 +291,7 @@ dim_reduce_func_def!("
285291
286292
# Examples
287293
288-
```
294+
```rust
289295
use arrayfire::{Dim4, print, randu, diff1};
290296
let dims = Dim4::new(&[5, 3, 1, 1]);
291297
let a = randu::<f32>(dims);
@@ -294,6 +300,7 @@ dim_reduce_func_def!("
294300
print(&b);
295301
let c = diff1(&a, 1);
296302
print(&c);
303+
```
297304
", diff1, af_diff1);
298305

299306
dim_reduce_func_def!("
@@ -310,7 +317,7 @@ dim_reduce_func_def!("
310317
311318
# Examples
312319
313-
```
320+
```rust
314321
use arrayfire::{Dim4, print, randu, diff2};
315322
let dims = Dim4::new(&[5, 3, 1, 1]);
316323
let a = randu::<f32>(dims);
@@ -319,6 +326,7 @@ dim_reduce_func_def!("
319326
print(&b);
320327
let c = diff2(&a, 1);
321328
print(&c);
329+
```
322330
", diff2, af_diff2);
323331

324332
/// Sum along specific dimension using user specified value instead of `NAN` values
@@ -400,7 +408,7 @@ all_reduce_func_def!("
400408
401409
# Examples
402410
403-
```
411+
```rust
404412
use arrayfire::{Dim4, print, randu, sum_all};
405413
let dims = Dim4::new(&[5, 5, 1, 1]);
406414
let a = randu::<f32>(dims);
@@ -424,7 +432,7 @@ all_reduce_func_def!("
424432
425433
# Examples
426434
427-
```
435+
```rust
428436
use arrayfire::{Dim4, print, randu, product_all};
429437
let dims = Dim4::new(&[5, 5, 1, 1]);
430438
let a = randu::<f32>(dims);
@@ -448,7 +456,7 @@ all_reduce_func_def!("
448456
449457
# Examples
450458
451-
```
459+
```rust
452460
use arrayfire::{Dim4, print, randu, min_all};
453461
let dims = Dim4::new(&[5, 5, 1, 1]);
454462
let a = randu::<f32>(dims);
@@ -472,7 +480,7 @@ all_reduce_func_def!("
472480
473481
# Examples
474482
475-
```
483+
```rust
476484
use arrayfire::{Dim4, print, randu, max_all};
477485
let dims = Dim4::new(&[5, 5, 1, 1]);
478486
let a = randu::<f32>(dims);
@@ -494,7 +502,7 @@ all_reduce_func_def!("
494502
495503
# Examples
496504
497-
```
505+
```rust
498506
use arrayfire::{Dim4, print, randu, all_true_all};
499507
let dims = Dim4::new(&[5, 5, 1, 1]);
500508
let a = randu::<f32>(dims);
@@ -516,12 +524,13 @@ all_reduce_func_def!("
516524
517525
# Examples
518526
519-
```
527+
```rust
520528
use arrayfire::{Dim4, print, randu, any_true_all};
521529
let dims = Dim4::new(&[5, 5, 1, 1]);
522530
let a = randu::<f32>(dims);
523531
print(&a);
524532
println!(\"Result : {:?}\", any_true_all(&a));
533+
```
525534
", any_true_all, af_any_true_all);
526535

527536
all_reduce_func_def!("
@@ -537,7 +546,7 @@ all_reduce_func_def!("
537546
538547
# Examples
539548
540-
```
549+
```rust
541550
use arrayfire::{Dim4, print, randu, count_all};
542551
let dims = Dim4::new(&[5, 5, 1, 1]);
543552
let a = randu::<f32>(dims);

src/array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl Array {
132132
///
133133
/// # Examples
134134
///
135-
/// ```
135+
/// ```rust
136136
/// use arrayfire::{Array, Dim4, print};
137137
/// let values: [f32; 3] = [1.0, 2.0, 3.0];
138138
/// let indices = Array::new(&values, Dim4::new(&[3, 1, 1, 1]));
@@ -419,7 +419,7 @@ impl Drop for Array {
419419
///
420420
/// # Examples
421421
///
422-
/// ```
422+
/// ```rust
423423
/// use arrayfire::{Dim4, print, randu};
424424
/// println!("Create a 5-by-3 matrix of random floats on the GPU");
425425
/// let dims = Dim4::new(&[5, 3, 1, 1]);
@@ -429,7 +429,7 @@ impl Drop for Array {
429429
///
430430
/// The sample output will look like below:
431431
///
432-
/// ```bash
432+
/// ```text
433433
/// [5 3 1 1]
434434
/// 0.7402 0.4464 0.7762
435435
/// 0.9210 0.6673 0.2948

src/data/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ pub fn upper(input: &Array, is_unit_diag: bool) -> Array {
481481
/// This function does the C-equivalent of the following statement, except that the operation
482482
/// happens on a GPU for all elements simultaneously.
483483
///
484-
/// ```ignore
484+
/// ```text
485485
/// c = cond ? a : b; /// where cond, a & b are all objects of type Array
486486
/// ```
487487
///
@@ -512,7 +512,7 @@ pub fn select(a: &Array, cond: &Array, b: &Array) -> Array {
512512
/// This function does the C-equivalent of the following statement, except that the operation
513513
/// happens on a GPU for all elements simultaneously.
514514
///
515-
/// ```ignore
515+
/// ```text
516516
/// c = cond ? a : b; /// where a is a scalar(f64) and b is Array
517517
/// ```
518518
///
@@ -543,7 +543,7 @@ pub fn selectl(a: f64, cond: &Array, b: &Array) -> Array {
543543
/// This function does the C-equivalent of the following statement, except that the operation
544544
/// happens on a GPU for all elements simultaneously.
545545
///
546-
/// ```ignore
546+
/// ```text
547547
/// c = cond ? a : b; /// where a is Array and b is a scalar(f64)
548548
/// ```
549549
///
@@ -574,7 +574,7 @@ pub fn selectr(a: &Array, cond: &Array, b: f64) -> Array {
574574
/// This function does the C-equivalent of the following statement, except that the operation
575575
/// happens on a GPU for all elements simultaneously.
576576
///
577-
/// ```ignore
577+
/// ```text
578578
/// a = cond ? a : b; /// where cond, a & b are all objects of type Array
579579
/// ```
580580
///
@@ -601,7 +601,7 @@ pub fn replace(a: &mut Array, cond: &Array, b: &Array) {
601601
/// This function does the C-equivalent of the following statement, except that the operation
602602
/// happens on a GPU for all elements simultaneously.
603603
///
604-
/// ```ignore
604+
/// ```text
605605
/// a = cond ? a : b; /// where cond, a are Arrays and b is scalar(f64)
606606
/// ```
607607
///

src/device/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn get_version() -> (i32, i32, i32) {
4444
///
4545
/// An example output of `af::info` call looks like below
4646
///
47-
/// ```ignore
47+
/// ```text
4848
/// ArrayFire v3.0.0 (CUDA, 64-bit Mac OSX, build d8d4b38)
4949
/// Platform: CUDA Toolkit 7, Driver: CUDA Driver Version: 7000
5050
/// [0] GeForce GT 750M, 2048 MB, CUDA Compute 3.0

src/dim4.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl Default for Dim4 {
1818
///
1919
/// # Examples
2020
///
21-
/// ```
21+
/// ```rust
2222
/// use arrayfire::Dim4;
2323
///
2424
/// let dims = Dim4::new(&[4, 4, 2, 1]);
@@ -39,7 +39,7 @@ impl Index<usize> for Dim4 {
3939
///
4040
/// # Examples
4141
///
42-
/// ```
42+
/// ```rust
4343
/// use arrayfire::Dim4;
4444
///
4545
/// let dims = Dim4::new(&[4, 4, 2, 1]);
@@ -56,7 +56,7 @@ impl Dim4 {
5656
///
5757
/// # Examples
5858
///
59-
/// ```
59+
/// ```rust
6060
/// use arrayfire::Dim4;
6161
/// let dims = Dim4::new(&[4, 4, 2, 1]);
6262
/// ```

src/graphics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub struct Cell {
8585
///
8686
/// # Examples
8787
///
88-
/// ```no_run
88+
/// ```rust,no_run
8989
/// use arrayfire::{histogram, load_image, Window};
9090
/// let mut wnd = Window::new(1280, 720, String::from("Image Histogram"));
9191
/// let img = load_image("Path to image".to_string(), true/*If color image, 'false' otherwise*/);

src/image/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ hsvrgb_func_def!("RGB to HSV color space conversion", rgb2hsv, af_rgb2hsv);
931931
///
932932
/// # Examples
933933
///
934-
/// ```ignore
934+
/// ```text
935935
/// A [5 5 1 1]
936936
/// 10 15 20 25 30
937937
/// 11 16 21 26 31

0 commit comments

Comments
 (0)