[−][src]Struct capra_core::common::dive_segment::DiveSegment
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]
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-type
isAscDesc
but start and end depths match.segment-type
is notAscDesc
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]
fn clone(&self) -> DiveSegment
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for DiveSegment
[src]
impl Debug for DiveSegment
[src]
Auto Trait Implementations
impl RefUnwindSafe for DiveSegment
impl Send for DiveSegment
impl Sync for DiveSegment
impl Unpin for DiveSegment
impl UnwindSafe for DiveSegment
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,