[][src]Struct capra_core::common::dive_segment::DiveSegment

pub struct DiveSegment { /* fields omitted */ }

The atomic unit of a dive. Every dive can be represented by a list of DiveSegments.

Implementations

impl DiveSegment[src]

pub fn new(
    segment_type: SegmentType,
    start_depth: usize,
    end_depth: usize,
    time: Duration,
    ascent_rate: isize,
    descent_rate: isize
) -> Result<Self, DiveSegmentError>
[src]

Returns a new DiveSegment with the given parameters.

Arguments

  • segment_type - Type of this segment. See SegmentType.
  • start_depth- Depth at the beginning of the segment.
  • end_depth - Depth at the end of the segment
  • time - 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-type is AscDesc but start and end depths match.
  • segment-type is not AscDesc but start and end depths do not match.

pub fn segment_type(&self) -> SegmentType[src]

Returns the type of the segment.

pub fn start_depth(&self) -> usize[src]

Returns the start depth of the segment.

pub fn end_depth(&self) -> usize[src]

Returns the end depth of the segment.

pub fn time(&self) -> &Duration[src]

Returns the duration of the segment.

pub fn ascent_rate(&self) -> isize[src]

Returns the ascent rate of the segment.

pub fn descent_rate(&self) -> isize[src]

Returns the descent rate of the segment.

pub fn gas_consumed(&self, sac_rate: usize, metres_per_bar: f64) -> usize[src]

Returns the quantity of gas a diver would consume in the segment.

Arguments

  • sac_rate - Surface Air Consumption (SAC) rate (measured in bar min^-1).
  • metres_per_bar - Depth of water required to induce 1 bar of pressure.

Trait Implementations

impl Clone for DiveSegment[src]

impl Copy for DiveSegment[src]

impl Debug for DiveSegment[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.