Charge

Struct Charge 

Source
pub struct Charge {
    pub m: Magnitude,
}
Expand description

Charge, in coulombs: C.

Fields§

§m: Magnitude

Implementations§

Source§

impl Charge

Source

pub const fn new(m: Magnitude) -> Self

Available on crate feature alloc only.

new Charge

Source

pub const fn m(&self) -> Magnitude

Available on crate feature alloc only.

Returns the magnitude.

Source§

impl Charge

Charge constants by order of magnitude

Source

pub const PROTON: Self

Available on crate feature alloc only.

(10e-19) The elementary charge of the proton.

Source

pub const ELECTRON: Self

Available on crate feature alloc only.

(10e-19) The elementary charge of the electron.

Source

pub const STATIC_RUBBING: Self

Available on crate feature alloc only.

(10e-6) Static electricity from rubbing materials together (1 µC).

Source

pub const THUNDERCLOUD: Self

Available on crate feature alloc only.

(10e1) Charge in a typical thundercloud (15-350 C).

Source

pub const AA_BATTERY: Self

Available on crate feature alloc only.

(10e3) Typical alkaline AA battery is about 5000 C ≈ 1.4 Ah.

Source

pub const FARADAY: Self

Available on crate feature alloc only.

(10e4) The Faraday constant represents the charge per mole of electrons.

Source§

impl Charge

§SI prefixes constructors: in_* & converters as_*

The Charge quantity is internally stored in coulombs (C).

Source

pub fn in_QC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in quettacoulombs (QC) (10³⁰ C).

Source

pub fn in_quettacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in quettacoulombs (QC) (10³⁰ C).

Source

pub fn as_QC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as quettacoulombs (QC) (10³⁰ C).

Source

pub fn as_quettacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as quettacoulombs (QC) (10³⁰ C).

Source

pub fn in_RC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in ronnacoulombs (RC) (10²⁷ C).

Source

pub fn in_ronnacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in ronnacoulombs (RC) (10²⁷ C).

Source

pub fn as_RC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as ronnacoulombs (RC) (10²⁷ C).

Source

pub fn as_ronnacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as ronnacoulombs (RC) (10²⁷ C).

Source

pub fn in_YC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in yottacoulombs (YC) (10²⁴ C).

Source

pub fn in_yottacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in yottacoulombs (YC) (10²⁴ C).

Source

pub fn as_YC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as yottacoulombs (YC) (10²⁴ C).

Source

pub fn as_yottacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as yottacoulombs (YC) (10²⁴ C).

Source

pub fn in_ZC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in zettacoulombs (ZC) (10²¹ C).

Source

pub fn in_zettacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in zettacoulombs (ZC) (10²¹ C).

Source

pub fn as_ZC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as zettacoulombs (ZC) (10²¹ C).

Source

pub fn as_zettacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as zettacoulombs (ZC) (10²¹ C).

Source

pub fn in_EC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in exacoulombs (EC) (10¹⁸ C).

Source

pub fn in_exacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in exacoulombs (EC) (10¹⁸ C).

Source

pub fn as_EC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as exacoulombs (EC) (10¹⁸ C).

Source

pub fn as_exacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as exacoulombs (EC) (10¹⁸ C).

Source

pub fn in_PC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in petacoulombs (PC) (10¹⁵ C).

Source

pub fn in_petacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in petacoulombs (PC) (10¹⁵ C).

Source

pub fn as_PC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as petacoulombs (PC) (10¹⁵ C).

Source

pub fn as_petacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as petacoulombs (PC) (10¹⁵ C).

Source

pub fn in_TC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in teracoulombs (TC) (10¹² C).

Source

pub fn in_teracoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in teracoulombs (TC) (10¹² C).

Source

pub fn as_TC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as teracoulombs (TC) (10¹² C).

Source

pub fn as_teracoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as teracoulombs (TC) (10¹² C).

Source

pub fn in_GC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in gigacoulombs (GC) (10⁹ C).

Source

pub fn in_gigacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in gigacoulombs (GC) (10⁹ C).

Source

pub fn as_GC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as gigacoulombs (GC) (10⁹ C).

Source

pub fn as_gigacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as gigacoulombs (GC) (10⁹ C).

Source

pub fn in_MC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in megacoulombs (MC) (10⁶ C).

Source

pub fn in_megacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in megacoulombs (MC) (10⁶ C).

Source

pub fn as_MC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as megacoulombs (MC) (10⁶ C).

Source

pub fn as_megacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as megacoulombs (MC) (10⁶ C).

Source

pub fn in_kC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in kilocoulombs (kC) (10³ C).

Source

pub fn in_kilocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in kilocoulombs (kC) (10³ C).

Source

pub fn as_kC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as kilocoulombs (kC) (10³ C).

Source

pub fn as_kilocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as kilocoulombs (kC) (10³ C).

Source

pub fn in_hC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in hectocoulombs (hC) (10² C).

Source

pub fn in_hectocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in hectocoulombs (hC) (10² C).

Source

pub fn as_hC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as hectocoulombs (hC) (10² C).

Source

pub fn as_hectocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as hectocoulombs (hC) (10² C).

Source

pub fn in_daC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in dekacoulombs (daC) (10¹ C).

Source

pub fn in_dekacoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in dekacoulombs (daC) (10¹ C).

Source

pub fn as_daC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as dekacoulombs (daC) (10¹ C).

Source

pub fn as_dekacoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as dekacoulombs (daC) (10¹ C).

Source

pub const fn in_C(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in coulombs (C) (base unit, 10⁰ C).

Source

pub const fn in_coulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in coulombs (C) (base unit, 10⁰ C).

Source

pub const fn as_C(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as coulombs (C) (base unit, 10⁰ C).

Source

pub const fn as_coulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as coulombs (C) (base unit, 10⁰ C).

Source

pub fn in_dC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in decicoulombs (dC) (10⁻¹ C).

Source

pub fn in_decicoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in decicoulombs (dC) (10⁻¹ C).

Source

pub fn as_dC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as decicoulombs (dC) (10⁻¹ C).

Source

pub fn as_decicoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as decicoulombs (dC) (10⁻¹ C).

Source

pub fn in_cC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in centicoulombs (cC) (10⁻² C).

Source

pub fn in_centicoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in centicoulombs (cC) (10⁻² C).

Source

pub fn as_cC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as centicoulombs (cC) (10⁻² C).

Source

pub fn as_centicoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as centicoulombs (cC) (10⁻² C).

Source

pub fn in_mC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in millicoulombs (mC) (10⁻³ C).

Source

pub fn in_millicoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in millicoulombs (mC) (10⁻³ C).

Source

pub fn as_mC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as millicoulombs (mC) (10⁻³ C).

Source

pub fn as_millicoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as millicoulombs (mC) (10⁻³ C).

Source

pub fn in_uC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in microcoulombs (uC) (10⁻⁶ C).

Source

pub fn in_microcoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in microcoulombs (uC) (10⁻⁶ C).

Source

pub fn as_uC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as microcoulombs (uC) (10⁻⁶ C).

Source

pub fn as_microcoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as microcoulombs (uC) (10⁻⁶ C).

Source

pub fn in_nC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in nanocoulombs (nC) (10⁻⁹ C).

Source

pub fn in_nanocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in nanocoulombs (nC) (10⁻⁹ C).

Source

pub fn as_nC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as nanocoulombs (nC) (10⁻⁹ C).

Source

pub fn as_nanocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as nanocoulombs (nC) (10⁻⁹ C).

Source

pub fn in_pC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in picocoulombs (pC) (10⁻¹² C).

Source

pub fn in_picocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in picocoulombs (pC) (10⁻¹² C).

Source

pub fn as_pC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as picocoulombs (pC) (10⁻¹² C).

Source

pub fn as_picocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as picocoulombs (pC) (10⁻¹² C).

Source

pub fn in_fC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in femtocoulombs (fC) (10⁻¹⁵ C).

Source

pub fn in_femtocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in femtocoulombs (fC) (10⁻¹⁵ C).

Source

pub fn as_fC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as femtocoulombs (fC) (10⁻¹⁵ C).

Source

pub fn as_femtocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as femtocoulombs (fC) (10⁻¹⁵ C).

Source

pub fn in_aC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in attocoulombs (aC) (10⁻¹⁸ C).

Source

pub fn in_attocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in attocoulombs (aC) (10⁻¹⁸ C).

Source

pub fn as_aC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as attocoulombs (aC) (10⁻¹⁸ C).

Source

pub fn as_attocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as attocoulombs (aC) (10⁻¹⁸ C).

Source

pub fn in_zC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in zeptocoulombs (zC) (10⁻²¹ C).

Source

pub fn in_zeptocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in zeptocoulombs (zC) (10⁻²¹ C).

Source

pub fn as_zC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as zeptocoulombs (zC) (10⁻²¹ C).

Source

pub fn as_zeptocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as zeptocoulombs (zC) (10⁻²¹ C).

Source

pub fn in_yC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in yoctocoulombs (yC) (10⁻²⁴ C).

Source

pub fn in_yoctocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in yoctocoulombs (yC) (10⁻²⁴ C).

Source

pub fn as_yC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as yoctocoulombs (yC) (10⁻²⁴ C).

Source

pub fn as_yoctocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as yoctocoulombs (yC) (10⁻²⁴ C).

Source

pub fn in_rC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in rontocoulombs (rC) (10⁻²⁷ C).

Source

pub fn in_rontocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in rontocoulombs (rC) (10⁻²⁷ C).

Source

pub fn as_rC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as rontocoulombs (rC) (10⁻²⁷ C).

Source

pub fn as_rontocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as rontocoulombs (rC) (10⁻²⁷ C).

Source

pub fn in_qC(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in quectocoulombs (qC) (10⁻³⁰ C).

Source

pub fn in_quectocoulombs(m: Magnitude) -> Self

Available on crate feature alloc only.

New Charge in quectocoulombs (qC) (10⁻³⁰ C).

Source

pub fn as_qC(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as quectocoulombs (qC) (10⁻³⁰ C).

Source

pub fn as_quectocoulombs(&self) -> Magnitude

Available on crate feature alloc only.

Returns Charge as quectocoulombs (qC) (10⁻³⁰ C).

Trait Implementations§

Source§

impl Clone for Charge

Available on crate feature alloc only.
Source§

fn clone(&self) -> Charge

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 Charge

Available on crate feature alloc only.
Source§

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

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

impl Display for Charge

Available on crate feature alloc only.
Source§

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

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

impl Unit for Charge

Available on crate feature alloc only.
Source§

fn unit() -> String

Returns the unit in short format.
Source§

fn unit_long_s(&self) -> String

Returns the unit in long format, singular.
Source§

fn unit_long_p(&self) -> String

Returns the unit in long format, plural.
Source§

fn unit_long(&self) -> String

Returns the unit in long format, singular if magnitude == 1, plural otherwise.
Source§

fn long(&self) -> String

Returns the unit and magnitude in long format.
Source§

impl Copy for Charge

Available on crate feature alloc only.

Auto Trait Implementations§

§

impl Freeze for Charge

§

impl RefUnwindSafe for Charge

§

impl Send for Charge

§

impl Sync for Charge

§

impl Unpin for Charge

§

impl UnwindSafe for Charge

Blanket Implementations§

Source§

impl<T> Also for T

Source§

fn also_mut<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Applies a function which takes the parameter by exclusive reference, and then returns the (possibly) modified owned value. Read more
Source§

fn also_ref<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Applies a function which takes the parameter by shared reference, and then returns the (possibly) modified owned value. Read more
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, Res> Apply<Res> for T
where T: ?Sized,

Source§

fn apply<F>(self, f: F) -> Res
where F: FnOnce(Self) -> Res, Self: Sized,

Apply a function which takes the parameter by value.
Source§

fn apply_ref<F>(&self, f: F) -> Res
where F: FnOnce(&Self) -> Res,

Apply a function which takes the parameter by shared reference.
Source§

fn apply_mut<F>(&mut self, f: F) -> Res
where F: FnOnce(&mut Self) -> Res,

Apply a function which takes the parameter by exclusive reference.
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.