pub struct ElectricCurrentArray<const N: usize> { /* private fields */ }Expand description
Array storage for a series of values and ElectricCurrentUnit.
Implementations§
Source§impl<const D: usize> ElectricCurrentArray<D>
impl<const D: usize> ElectricCurrentArray<D>
Sourcepub fn new(values: [f64; D], unit: ElectricCurrentUnit) -> Self
pub fn new(values: [f64; D], unit: ElectricCurrentUnit) -> Self
Create a new vector of ElectricCurrentUnit.
Sourcepub fn values_mut(&mut self) -> &mut [f64; D]
pub fn values_mut(&mut self) -> &mut [f64; D]
Retrieve the mutable values associated with this [ElectricCurrentSlice].
Sourcepub fn yottaampere(values: [f64; D]) -> Self
pub fn yottaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::yottaampere.
Sourcepub fn zettaampere(values: [f64; D]) -> Self
pub fn zettaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::zettaampere.
Sourcepub fn exaampere(values: [f64; D]) -> Self
pub fn exaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::exaampere.
Sourcepub fn petaampere(values: [f64; D]) -> Self
pub fn petaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::petaampere.
Sourcepub fn teraampere(values: [f64; D]) -> Self
pub fn teraampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::teraampere.
Sourcepub fn gigaampere(values: [f64; D]) -> Self
pub fn gigaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::gigaampere.
Sourcepub fn megaampere(values: [f64; D]) -> Self
pub fn megaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::megaampere.
Sourcepub fn kiloampere(values: [f64; D]) -> Self
pub fn kiloampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::kiloampere.
Sourcepub fn hectoampere(values: [f64; D]) -> Self
pub fn hectoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::hectoampere.
Sourcepub fn decaampere(values: [f64; D]) -> Self
pub fn decaampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::decaampere.
Sourcepub fn ampere(values: [f64; D]) -> Self
pub fn ampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::ampere.
Sourcepub fn deciampere(values: [f64; D]) -> Self
pub fn deciampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::deciampere.
Sourcepub fn centiampere(values: [f64; D]) -> Self
pub fn centiampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::centiampere.
Sourcepub fn milliampere(values: [f64; D]) -> Self
pub fn milliampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::milliampere.
Sourcepub fn microampere(values: [f64; D]) -> Self
pub fn microampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::microampere.
Sourcepub fn nanoampere(values: [f64; D]) -> Self
pub fn nanoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::nanoampere.
Sourcepub fn picoampere(values: [f64; D]) -> Self
pub fn picoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::picoampere.
Sourcepub fn femtoampere(values: [f64; D]) -> Self
pub fn femtoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::femtoampere.
Sourcepub fn attoampere(values: [f64; D]) -> Self
pub fn attoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::attoampere.
Sourcepub fn zeptoampere(values: [f64; D]) -> Self
pub fn zeptoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::zeptoampere.
Sourcepub fn yoctoampere(values: [f64; D]) -> Self
pub fn yoctoampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::yoctoampere.
Sourcepub fn elementary_charge_per_second(values: [f64; D]) -> Self
pub fn elementary_charge_per_second(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::elementary_charge_per_second.
Sourcepub fn atomic_unit_of_charge_per_second(values: [f64; D]) -> Self
pub fn atomic_unit_of_charge_per_second(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::atomic_unit_of_charge_per_second.
Sourcepub fn abampere(values: [f64; D]) -> Self
pub fn abampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::abampere.
Sourcepub fn gilbert(values: [f64; D]) -> Self
pub fn gilbert(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::gilbert.
Sourcepub fn statampere(values: [f64; D]) -> Self
pub fn statampere(values: [f64; D]) -> Self
Create a new ElectricCurrent with units of ElectricCurrentUnit::statampere.
Sourcepub fn to_yottaampere(&self) -> Self
pub fn to_yottaampere(&self) -> Self
Convert to ElectricCurrentUnit::yottaampere.
Sourcepub fn to_zettaampere(&self) -> Self
pub fn to_zettaampere(&self) -> Self
Convert to ElectricCurrentUnit::zettaampere.
Sourcepub fn to_exaampere(&self) -> Self
pub fn to_exaampere(&self) -> Self
Convert to ElectricCurrentUnit::exaampere.
Sourcepub fn to_petaampere(&self) -> Self
pub fn to_petaampere(&self) -> Self
Convert to ElectricCurrentUnit::petaampere.
Sourcepub fn to_teraampere(&self) -> Self
pub fn to_teraampere(&self) -> Self
Convert to ElectricCurrentUnit::teraampere.
Sourcepub fn to_gigaampere(&self) -> Self
pub fn to_gigaampere(&self) -> Self
Convert to ElectricCurrentUnit::gigaampere.
Sourcepub fn to_megaampere(&self) -> Self
pub fn to_megaampere(&self) -> Self
Convert to ElectricCurrentUnit::megaampere.
Sourcepub fn to_kiloampere(&self) -> Self
pub fn to_kiloampere(&self) -> Self
Convert to ElectricCurrentUnit::kiloampere.
Sourcepub fn to_hectoampere(&self) -> Self
pub fn to_hectoampere(&self) -> Self
Convert to ElectricCurrentUnit::hectoampere.
Sourcepub fn to_decaampere(&self) -> Self
pub fn to_decaampere(&self) -> Self
Convert to ElectricCurrentUnit::decaampere.
Sourcepub fn to_ampere(&self) -> Self
pub fn to_ampere(&self) -> Self
Convert to ElectricCurrentUnit::ampere.
Sourcepub fn to_deciampere(&self) -> Self
pub fn to_deciampere(&self) -> Self
Convert to ElectricCurrentUnit::deciampere.
Sourcepub fn to_centiampere(&self) -> Self
pub fn to_centiampere(&self) -> Self
Convert to ElectricCurrentUnit::centiampere.
Sourcepub fn to_milliampere(&self) -> Self
pub fn to_milliampere(&self) -> Self
Convert to ElectricCurrentUnit::milliampere.
Sourcepub fn to_microampere(&self) -> Self
pub fn to_microampere(&self) -> Self
Convert to ElectricCurrentUnit::microampere.
Sourcepub fn to_nanoampere(&self) -> Self
pub fn to_nanoampere(&self) -> Self
Convert to ElectricCurrentUnit::nanoampere.
Sourcepub fn to_picoampere(&self) -> Self
pub fn to_picoampere(&self) -> Self
Convert to ElectricCurrentUnit::picoampere.
Sourcepub fn to_femtoampere(&self) -> Self
pub fn to_femtoampere(&self) -> Self
Convert to ElectricCurrentUnit::femtoampere.
Sourcepub fn to_attoampere(&self) -> Self
pub fn to_attoampere(&self) -> Self
Convert to ElectricCurrentUnit::attoampere.
Sourcepub fn to_zeptoampere(&self) -> Self
pub fn to_zeptoampere(&self) -> Self
Convert to ElectricCurrentUnit::zeptoampere.
Sourcepub fn to_yoctoampere(&self) -> Self
pub fn to_yoctoampere(&self) -> Self
Convert to ElectricCurrentUnit::yoctoampere.
Sourcepub fn to_elementary_charge_per_second(&self) -> Self
pub fn to_elementary_charge_per_second(&self) -> Self
Sourcepub fn to_atomic_unit_of_charge_per_second(&self) -> Self
pub fn to_atomic_unit_of_charge_per_second(&self) -> Self
Sourcepub fn to_abampere(&self) -> Self
pub fn to_abampere(&self) -> Self
Convert to ElectricCurrentUnit::abampere.
Sourcepub fn to_gilbert(&self) -> Self
pub fn to_gilbert(&self) -> Self
Convert to ElectricCurrentUnit::gilbert.
Sourcepub fn to_statampere(&self) -> Self
pub fn to_statampere(&self) -> Self
Convert to ElectricCurrentUnit::statampere.
pub fn at(&self, index: usize) -> ElectricCurrent
Methods from Deref<Target = [f64; N]>§
1.57.0 · Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Returns a slice containing the entire array. Equivalent to &s[..].
1.57.0 · Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..].
1.77.0 · Sourcepub fn each_ref(&self) -> [&T; N]
pub fn each_ref(&self) -> [&T; N]
Borrows each element and returns an array of references with the same
size as self.
§Example
let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);This method is particularly useful if combined with other methods, like
map. This way, you can avoid moving the original
array if its elements are not Copy.
let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);
// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);1.77.0 · Sourcepub fn each_mut(&mut self) -> [&mut T; N]
pub fn each_mut(&mut self) -> [&mut T; N]
Borrows each element mutably and returns an array of mutable references
with the same size as self.
§Example
let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);Sourcepub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
🔬This is a nightly-only experimental API. (split_array)
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
split_array)Divides one array reference into two at an index.
The first will contain all indices from [0, M) (excluding
the index M itself) and the second will contain all
indices from [M, N) (excluding the index N itself).
§Panics
Panics if M > N.
§Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.split_array_ref::<0>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<2>();
assert_eq!(left, &[1, 2]);
assert_eq!(right, &[3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<6>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}Sourcepub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
🔬This is a nightly-only experimental API. (split_array)
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
split_array)Divides one mutable array reference into two at an index.
The first will contain all indices from [0, M) (excluding
the index M itself) and the second will contain all
indices from [M, N) (excluding the index N itself).
§Panics
Panics if M > N.
§Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0][..]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);Sourcepub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
🔬This is a nightly-only experimental API. (split_array)
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
split_array)Divides one array reference into two at an index from the end.
The first will contain all indices from [0, N - M) (excluding
the index N - M itself) and the second will contain all
indices from [N - M, N) (excluding the index N itself).
§Panics
Panics if M > N.
§Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.rsplit_array_ref::<0>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
{
let (left, right) = v.rsplit_array_ref::<2>();
assert_eq!(left, &[1, 2, 3, 4]);
assert_eq!(right, &[5, 6]);
}
{
let (left, right) = v.rsplit_array_ref::<6>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}Sourcepub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
🔬This is a nightly-only experimental API. (split_array)
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
split_array)Divides one mutable array reference into two at an index from the end.
The first will contain all indices from [0, N - M) (excluding
the index N - M itself) and the second will contain all
indices from [N - M, N) (excluding the index N itself).
§Panics
Panics if M > N.
§Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6][..]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);Trait Implementations§
Source§impl<const N: usize> Add for ElectricCurrentArray<N>
impl<const N: usize> Add for ElectricCurrentArray<N>
Source§type Output = ElectricCurrentArray<N>
type Output = ElectricCurrentArray<N>
+ operator.Source§fn add(self, rhs: ElectricCurrentArray<N>) -> Self
fn add(self, rhs: ElectricCurrentArray<N>) -> Self
+ operation. Read moreSource§impl<const N: usize> AddAssign for ElectricCurrentArray<N>
impl<const N: usize> AddAssign for ElectricCurrentArray<N>
Source§fn add_assign(&mut self, rhs: ElectricCurrentArray<N>)
fn add_assign(&mut self, rhs: ElectricCurrentArray<N>)
+= operation. Read moreSource§impl<const N: usize> Clone for ElectricCurrentArray<N>
impl<const N: usize> Clone for ElectricCurrentArray<N>
Source§fn clone(&self) -> ElectricCurrentArray<N>
fn clone(&self) -> ElectricCurrentArray<N>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const N: usize> Debug for ElectricCurrentArray<N>
impl<const N: usize> Debug for ElectricCurrentArray<N>
Source§impl<const N: usize> Default for ElectricCurrentArray<N>
impl<const N: usize> Default for ElectricCurrentArray<N>
Source§impl<const N: usize> Deref for ElectricCurrentArray<N>
impl<const N: usize> Deref for ElectricCurrentArray<N>
Source§impl<const N: usize> DerefMut for ElectricCurrentArray<N>
impl<const N: usize> DerefMut for ElectricCurrentArray<N>
Source§impl<const N: usize> DivAssign<f64> for ElectricCurrentArray<N>
impl<const N: usize> DivAssign<f64> for ElectricCurrentArray<N>
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/= operation. Read moreSource§impl<const N: usize> FixedSliceQuantity<ElectricCurrentUnit, f64> for ElectricCurrentArray<N>
impl<const N: usize> FixedSliceQuantity<ElectricCurrentUnit, f64> for ElectricCurrentArray<N>
Source§fn unit(&self) -> ElectricCurrentUnit
fn unit(&self) -> ElectricCurrentUnit
Source§fn values_mut(&mut self) -> &mut [f64]
fn values_mut(&mut self) -> &mut [f64]
Source§fn convert(&self, unit: ElectricCurrentUnit) -> Self
fn convert(&self, unit: ElectricCurrentUnit) -> Self
UnitType to another of the same type. No validation of base unit is made.Source§fn convert_mut(&mut self, unit: ElectricCurrentUnit)
fn convert_mut(&mut self, unit: ElectricCurrentUnit)
UnitType to another of the same type. No validation of base unit is made.Source§fn try_convert(&self, unit: Units) -> Result<Self, RuntimeUnitError>where
Self: Sized,
fn try_convert(&self, unit: Units) -> Result<Self, RuntimeUnitError>where
Self: Sized,
unit to a UnitType. Base unit validation is made here.Source§impl<const N: usize> MulAssign<f64> for ElectricCurrentArray<N>
impl<const N: usize> MulAssign<f64> for ElectricCurrentArray<N>
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
*= operation. Read moreSource§impl<const N: usize> PartialEq for ElectricCurrentArray<N>
impl<const N: usize> PartialEq for ElectricCurrentArray<N>
Source§fn eq(&self, other: &ElectricCurrentArray<N>) -> bool
fn eq(&self, other: &ElectricCurrentArray<N>) -> bool
self and other values to be equal, and is used by ==.Source§impl<const N: usize> Sub for ElectricCurrentArray<N>
impl<const N: usize> Sub for ElectricCurrentArray<N>
Source§type Output = ElectricCurrentArray<N>
type Output = ElectricCurrentArray<N>
- operator.Source§fn sub(self, rhs: ElectricCurrentArray<N>) -> Self
fn sub(self, rhs: ElectricCurrentArray<N>) -> Self
- operation. Read moreSource§impl<const N: usize> SubAssign for ElectricCurrentArray<N>
impl<const N: usize> SubAssign for ElectricCurrentArray<N>
Source§fn sub_assign(&mut self, rhs: ElectricCurrentArray<N>)
fn sub_assign(&mut self, rhs: ElectricCurrentArray<N>)
-= operation. Read more