Gas

Struct Gas 

Source
pub struct Gas { /* private fields */ }
Expand description

A gas mix used in a dive.

Implementations§

Source§

impl Gas

Source

pub fn new(o2: usize, he: usize, n2: usize) -> Result<Self, GasError>

Returns a new Gas with the given parameters.

§Arguments
  • o2 - Percentage fraction of oxygen in the mix.
  • he - Percentage fraction of helium in the mix.
  • n2 - Percentage fraction of nitrogen in the mix.
§Errors

This function will return a GasError if the percentage fractions do not add up to 100.

Source

pub fn fr_n2(&self) -> f64

Returns the fraction of nitrogen in the mix.

Source

pub fn fr_o2(&self) -> f64

Returns the fraction of oxygen in the mix.

Source

pub fn fr_he(&self) -> f64

Returns the fraction of helium in the mix.

Source

pub fn o2(&self) -> usize

Returns the percentage fraction of oxygen in the mix.

Source

pub fn he(&self) -> usize

Returns the percentage fraction of helium in the mix.

Source

pub fn n2(&self) -> usize

Returns the percentage fraction of nitrogen in the mix.

Source

pub fn equivalent_narcotic_depth(&self, depth: usize) -> usize

Returns the Equivalent Narcotic Depth (END) of the mix at a given depth.

§Arguments
  • depth - The depth the mix is being breathed at.
Source

pub fn in_ppo2_range(&self, depth: usize, min: f64, max: f64) -> bool

Helper function to check whether the mix is in an acceptable ppO2 range at a given depth.

§Arguments
  • depth -Depth the mix is being breathed at.
  • min - Minimum tolerable ppO2.
  • max - Maximum tolerable ppO2.
Source

pub fn pp_o2(&self, depth: usize, metres_per_bar: f64) -> f64

Returns the ppO2 of the mix at a given depth.

§Arguments
  • depth - Depth the mix is being breathed at.
  • metres_per_bar - Depth of water required to induce 1 bar of pressure.
Source

pub fn pp_he(&self, depth: usize, metres_per_bar: f64) -> f64

Returns the ppHe of the mix at a given depth.

§Arguments
  • depth - Depth the mix is being breathed at.
  • metres_per_bar - Depth of water required to induce 1 bar of pressure.
Source

pub fn pp_n2(&self, depth: usize, metre_per_bar: f64) -> f64

Returns the ppN2 of the mix at a given depth.

§Arguments
  • depth - Depth the mix is being breathed at.
  • metres_per_bar - Depth of water required to induce 1 bar of pressure.

Trait Implementations§

Source§

impl Clone for Gas

Source§

fn clone(&self) -> Gas

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Gas

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Gas

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Gas

Source§

fn eq(&self, other: &Gas) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Gas

Source§

impl Eq for Gas

Source§

impl StructuralPartialEq for Gas

Auto Trait Implementations§

§

impl Freeze for Gas

§

impl RefUnwindSafe for Gas

§

impl Send for Gas

§

impl Sync for Gas

§

impl Unpin for Gas

§

impl UnwindSafe for Gas

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.