Skip to content

Commit ab1085e

Browse files
fix: repair broken doctests
1 parent 74e5c6a commit ab1085e

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

capt/src/lib.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//! let r_min = 0.05;
3939
//! let r_max = 2.0;
4040
//!
41-
//! let capt = Capt::<2>::new(&points, (r_min, r_max));
41+
//! let capt = Capt::<2>::new(&points, (r_min, r_max), 1);
4242
//! ```
4343
//!
4444
//! Once you have a `Capt`, you can use it for collision-checking against spheres.
@@ -48,7 +48,7 @@
4848
//! ```rust
4949
//! # use capt::Capt;
5050
//! # let points = [[0.0, 1.1], [0.2, 3.1]];
51-
//! # let capt = Capt::<2>::new(&points, (0.05, 2.0));
51+
//! # let capt = Capt::<2>::new(&points, (0.05, 2.0), 1);
5252
//! let center = [0.0, 0.0]; // center of sphere
5353
//! let radius0 = 1.0; // radius of sphere
5454
//! assert!(!capt.collides(&center, radius0));
@@ -361,7 +361,7 @@ where
361361
/// let points = [[0.0, 0.1], [0.4, -0.2], [-0.2, -0.1]];
362362
///
363363
/// // query radii must be between 0.0 and 0.2
364-
/// let t = capt::Capt::<2>::new(&points, (0.0, 0.2));
364+
/// let t = capt::Capt::<2>::new(&points, (0.0, 0.2), 1);
365365
///
366366
/// assert!(!t.collides(&[0.0, 0.3], 0.1));
367367
/// assert!(t.collides(&[0.0, 0.2], 0.15));
@@ -438,7 +438,7 @@ where
438438
/// ```
439439
/// let points = [[0.0]];
440440
///
441-
/// let capt = capt::Capt::<1>::new(&points, (0.0, f32::INFINITY));
441+
/// let capt = capt::Capt::<1>::new(&points, (0.0, f32::INFINITY), 1);
442442
///
443443
/// assert!(capt.collides(&[1.0], 1.5));
444444
/// assert!(!capt.collides(&[1.0], 0.5));
@@ -450,7 +450,7 @@ where
450450
/// let points = [[0.0]; 256];
451451
///
452452
/// // note that we are using `u8` as our index type
453-
/// let capt = capt::Capt::<1, 8, f32, u8>::new(&points, (0.0, f32::INFINITY));
453+
/// let capt = capt::Capt::<1, f32, u8>::new(&points, (0.0, f32::INFINITY), 1);
454454
/// ```
455455
pub fn new(points: &[[A; K]], r_range: (A, A), n_lanes: usize) -> Self {
456456
Self::try_new(points, r_range, n_lanes)
@@ -476,7 +476,7 @@ where
476476
/// ```
477477
/// let points = [[0.0]];
478478
///
479-
/// let capt = capt::Capt::<1>::with_point_radius(&points, (0.0, f32::INFINITY), 0.2);
479+
/// let capt = capt::Capt::<1>::with_point_radius(&points, (0.0, f32::INFINITY), 0.2, 1);
480480
///
481481
/// assert!(capt.collides(&[1.0], 1.5));
482482
/// assert!(!capt.collides(&[1.0], 0.5));
@@ -488,7 +488,7 @@ where
488488
/// let points = [[0.0]; 256];
489489
///
490490
/// // note that we are using `u8` as our index type
491-
/// let capt = capt::Capt::<1, 8, f32, u8>::with_point_radius(&points, (0.0, f32::INFINITY), 0.2);
491+
/// let capt = capt::Capt::<1, f32, u8>::with_point_radius(&points, (0.0, f32::INFINITY), 0.2, 1);
492492
/// ```
493493
pub fn with_point_radius(
494494
points: &[[A; K]],
@@ -520,7 +520,7 @@ where
520520
/// ```
521521
/// let points = [[0.0]];
522522
///
523-
/// let capt = capt::Capt::<1>::try_new(&points, (0.0, f32::INFINITY)).unwrap();
523+
/// let capt = capt::Capt::<1>::try_new(&points, (0.0, f32::INFINITY), 1).unwrap();
524524
/// ```
525525
///
526526
/// In failure, we get an `Err`.
@@ -529,7 +529,7 @@ where
529529
/// let points = [[0.0]; 256];
530530
///
531531
/// // note that we are using `u8` as our index type
532-
/// let opt = capt::Capt::<1, 8, f32, u8>::try_new(&points, (0.0, f32::INFINITY));
532+
/// let opt = capt::Capt::<1, f32, u8>::try_new(&points, (0.0, f32::INFINITY), 8);
533533
///
534534
/// assert!(opt.is_err());
535535
/// ```
@@ -563,7 +563,8 @@ where
563563
/// ```
564564
/// let points = [[0.0]];
565565
///
566-
/// let capt = capt::Capt::<1>::try_with_point_radius(&points, (0.0, f32::INFINITY), 0.01).unwrap();
566+
/// let capt =
567+
/// capt::Capt::<1>::try_with_point_radius(&points, (0.0, f32::INFINITY), 0.01, 1).unwrap();
567568
/// ```
568569
///
569570
/// In failure, we get an `Err`.
@@ -573,7 +574,7 @@ where
573574
///
574575
/// // note that we are using `u8` as our index type
575576
/// let opt =
576-
/// capt::Capt::<1, 8, f32, u8>::try_with_point_radius(&points, (0.0, f32::INFINITY), 0.01);
577+
/// capt::Capt::<1, f32, u8>::try_with_point_radius(&points, (0.0, f32::INFINITY), 0.01, 1);
577578
///
578579
/// assert!(opt.is_err());
579580
/// ```
@@ -804,7 +805,7 @@ where
804805
///
805806
/// ```
806807
/// let points = [[0.0; 3], [1.0; 3], [0.1, 0.5, 1.0]];
807-
/// let capt = capt::Capt::<3>::new(&points, (0.0, 1.0));
808+
/// let capt = capt::Capt::<3>::new(&points, (0.0, 1.0), 1);
808809
///
809810
/// assert!(capt.collides(&[1.1; 3], 0.2));
810811
/// assert!(!capt.collides(&[2.0; 3], 1.0));
@@ -900,7 +901,7 @@ where
900901
/// ];
901902
/// let radii = Simd::splat(0.05);
902903
///
903-
/// let tree = capt::Capt::<2, 4, f32, u32>::new(&points, (0.0, 0.1));
904+
/// let tree = capt::Capt::<2, f32, u32>::new(&points, (0.0, 0.1), 4);
904905
///
905906
/// println!("{tree:?}");
906907
///

0 commit comments

Comments
 (0)