Skip to content

Commit

Permalink
docs: make docs match impl
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Mar 29, 2023
1 parent 2fc0e2e commit 2ab18ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/coord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ where
/// Panics if any:
///
/// - `rtt <= 0.0`
/// - This coordinate's AND the other's error estimate `<= 0.0`
/// - This coordinate's OR the other's error estimate `<= 0.0`
pub fn update_until(&mut self, rtt: f64, other: &Coord<T>, threshold: f64, cfg: &Config) {
// TODO: dont go negative
let low = rtt - threshold;
Expand All @@ -263,11 +263,9 @@ where
/// Panics if any:
///
/// - `rtt <= 0.0`
/// - This coordinate's AND the other's error estimate `<= 0.0`
/// - This coordinate's OR the other's error estimate `<= 0.0`
pub fn update(&mut self, rtt: f64, other: &Coord<T>, cfg: &Config) {
// @TODO assert or Err()?
assert!(self.error_estimate > 0.0 || other.error_estimate > 0.0);
assert!(rtt > 0.0);
assert!(self.error_estimate > 0.0 && other.error_estimate > 0.0 && rtt > 0.0);

// Sample weight balances local and other error
// - A high local error = greater movement
Expand Down
4 changes: 2 additions & 2 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
/// Panics if any:
///
/// - `rtt <= 0.0`
/// - This coordinate's AND the other's error estimate `<= 0.0`
/// - This coordinate's OR the other's error estimate `<= 0.0`
pub fn update_until(&mut self, rtt: Duration, other: &Coord<V>, threshold: f64) {
self.coord.update_until(
f64::max(f64::MIN_POSITIVE, rtt.as_secs_f64()),
Expand Down Expand Up @@ -274,7 +274,7 @@ where
///
/// Panics if any:
///
/// - This coordinate's AND the remote's error estimate `<= 0.0`
/// - This coordinate's OR the remote's error estimate `<= 0.0`
pub fn update(&mut self, rtt: Duration, other: &Coord<V>) -> bool {
let coord = self.coord.clone();
if let Err(Error {
Expand Down

0 comments on commit 2ab18ec

Please sign in to comment.