Skip to content

Commit

Permalink
Add SplineSpec::segments
Browse files Browse the repository at this point in the history
This lets us access segments in contexts where we do not have
mutable access to the solver.
  • Loading branch information
cmyr committed Jan 27, 2021
1 parent 1ab5ecd commit 964b6d2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/spline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ impl SplineSpec {
&mut self.elements
}

/// Returns the current solution, if it is up-to-date.
///
/// If it is not up-to-date, you need to call [`solve`](SplineSpec::solve)
/// first.
pub fn segments(&self) -> Option<&[Segment]> {
if self.dirty {
None
} else {
Some(&self.segments)
}
}

/// Returns the solved spline based on the current elements.
///
/// The returned [`Spline`] borrows data from `self`; if you need an
Expand Down

0 comments on commit 964b6d2

Please sign in to comment.