pub struct DiveSegment { /* private fields */ }Expand description
The atomic unit of a dive. Every dive can be represented by a list of DiveSegments.
Implementations§
Source§impl DiveSegment
impl DiveSegment
Sourcepub fn new(
segment_type: SegmentType,
start_depth: usize,
end_depth: usize,
time: Duration,
ascent_rate: isize,
descent_rate: isize,
) -> Result<Self, DiveSegmentError>
pub fn new( segment_type: SegmentType, start_depth: usize, end_depth: usize, time: Duration, ascent_rate: isize, descent_rate: isize, ) -> Result<Self, DiveSegmentError>
Returns a new DiveSegment with the given parameters.
§Arguments
segment_type- Type of this segment. SeeSegmentType.start_depth- Depth at the beginning of the segment.end_depth- Depth at the end of the segmenttime- Duration of the segment.ascent_rate- Ascent rate of the segment (measured in m min^-1)descent_rate- Descent rate of the segment (measured in m min^-1)
§Errors
This function will return a DiveSegmentError if any of the following are true:
segment-typeisAscDescbut start and end depths match.segment-typeis notAscDescbut start and end depths do not match.
Sourcepub fn segment_type(&self) -> SegmentType
pub fn segment_type(&self) -> SegmentType
Returns the type of the segment.
Sourcepub fn start_depth(&self) -> usize
pub fn start_depth(&self) -> usize
Returns the start depth of the segment.
Sourcepub fn ascent_rate(&self) -> isize
pub fn ascent_rate(&self) -> isize
Returns the ascent rate of the segment.
Sourcepub fn descent_rate(&self) -> isize
pub fn descent_rate(&self) -> isize
Returns the descent rate of the segment.
Trait Implementations§
Source§impl Clone for DiveSegment
impl Clone for DiveSegment
Source§fn clone(&self) -> DiveSegment
fn clone(&self) -> DiveSegment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiveSegment
impl Debug for DiveSegment
impl Copy for DiveSegment
Auto Trait Implementations§
impl Freeze for DiveSegment
impl RefUnwindSafe for DiveSegment
impl Send for DiveSegment
impl Sync for DiveSegment
impl Unpin for DiveSegment
impl UnwindSafe for DiveSegment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more