Si

Struct Si 

Source
pub struct Si<Value: Scalar, D: Dimensional, Pr: Prefixed>(pub Value, pub PhantomData<(D, Pr)>);
Expand description

SI基础结构

§类型参数

  • Pr: SI前缀类型
  • D: 量纲类型

Tuple Fields§

§0: Value§1: PhantomData<(D, Pr)>

Implementations§

Source§

impl<T, D, Pr> Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar,

Source

pub fn new(value: T) -> Self

创建新的SI量

Trait Implementations§

Source§

impl<V, D, Pr> Add for Si<V, D, Pr>
where V: Scalar + Add<V, Output = V>, D: Dimensional, Pr: Prefixed,

Source§

fn add(self, rhs: Self) -> Self::Output

加法(要求相同前缀和量纲)

Source§

type Output = Si<V, D, Pr>

The resulting type after applying the + operator.
Source§

impl<T, D, Pr> AddAssign<T> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + AddAssign<Var<T>>,

Source§

fn add_assign(&mut self, rhs: T)

标量加法赋值 (+=)

Source§

impl<T, D, Pr> AddAssign<Var<T>> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + AddAssign<Var<T>>,

Source§

fn add_assign(&mut self, rhs: Var<T>)

Performs the += operation. Read more
Source§

impl<V, D: Dimensional, Pr: Prefixed> AddAssign for Si<V, D, Pr>
where V: AddAssign<V> + Scalar,

Source§

fn add_assign(&mut self, rhs: Self)

加法赋值(要求相同前缀和量纲)

Source§

impl<Value: Clone + Scalar, D: Clone + Dimensional, Pr: Clone + Prefixed> Clone for Si<Value, D, Pr>

Source§

fn clone(&self) -> Si<Value, D, Pr>

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<Value: Debug + Scalar, D: Debug + Dimensional, Pr: Debug + Prefixed> Debug for Si<Value, D, Pr>

Source§

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

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

impl<V, D1, D2, Pr1, Pr2> Div<Si<V, D2, Pr2>> for Si<V, D1, Pr1>
where V: Scalar + Div<V, Output: Scalar>, D1: Dimensional + Div<D2, Output: Dimensional>, D2: Dimensional, Pr1: Prefixed + Div<Pr2, Output: Prefixed>, Pr2: Prefixed,

Source§

fn div(self, rhs: Si<V, D2, Pr2>) -> Self::Output

除法

Source§

type Output = Si<<V as Div>::Output, <D1 as Div<D2>>::Output, <Pr1 as Div<Pr2>>::Output>

The resulting type after applying the / operator.
Source§

impl<S, R, T, D, Pr> Div<Si<Var<T>, D, Pr>> for Unit<S, R>
where T: Numeric, Var<T>: Scalar, D: Dimensional, Pr: Prefixed, S: Sied + Div<Si<Var<T>, D, Pr>, Output: Sied>, Si<Var<T>, D, Pr>: Sied, R: Scaled,

Source§

fn div(self, rhs: Si<Var<T>, D, Pr>) -> Self::Output

物理量除法

Source§

type Output = Unit<<S as Div<Si<Var<T>, D, Pr>>>::Output, R>

The resulting type after applying the / operator.
Source§

impl<T, D1, Pr1, D2, Pr2, R> Div<Unit<Si<Var<T>, D2, Pr2>, R>> for Si<Var<T>, D1, Pr1>
where T: Numeric, Var<T>: Scalar, D1: Dimensional, D2: Dimensional, Pr1: Prefixed, Pr2: Prefixed, R: Scaled, NoRatio: Div<R>, Si<Var<T>, D1, Pr1>: Div<Si<Var<T>, D2, Pr2>, Output: Sied>,

Source§

fn div(self, rhs: Unit<Si<Var<T>, D2, Pr2>, R>) -> Self::Output

物理量除法

Source§

type Output = Unit<<Si<Var<T>, D1, Pr1> as Div<Si<Var<T>, D2, Pr2>>>::Output, <Ratio<Z0, Z0, Z0, Z0> as Div<R>>::Output>

The resulting type after applying the / operator.
Source§

impl<T, D, Pr> DivAssign<T> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + DivAssign<Var<T>>,

Source§

fn div_assign(&mut self, rhs: T)

标量除法赋值 (/=)

Source§

impl<T, D, Pr> DivAssign<Var<T>> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + DivAssign<Var<T>>,

Source§

fn div_assign(&mut self, rhs: Var<T>)

Performs the /= operation. Read more
Source§

impl<V, D1, D2, Pr1, Pr2> Mul<Si<V, D2, Pr2>> for Si<V, D1, Pr1>
where V: Scalar + Mul<V, Output: Scalar>, D1: Dimensional + Mul<D2, Output: Dimensional>, D2: Dimensional, Pr1: Prefixed + Mul<Pr2, Output: Prefixed>, Pr2: Prefixed,

Source§

fn mul(self, rhs: Si<V, D2, Pr2>) -> Self::Output

乘法(量纲相乘,前缀相加)

Source§

type Output = Si<<V as Mul>::Output, <D1 as Mul<D2>>::Output, <Pr1 as Mul<Pr2>>::Output>

The resulting type after applying the * operator.
Source§

impl<S, R, T, D, Pr> Mul<Si<Var<T>, D, Pr>> for Unit<S, R>
where T: Numeric, Var<T>: Scalar, D: Dimensional, Pr: Prefixed, S: Sied + Mul<Si<Var<T>, D, Pr>, Output: Sied>, Si<Var<T>, D, Pr>: Sied, R: Scaled,

Source§

fn mul(self, rhs: Si<Var<T>, D, Pr>) -> Self::Output

物理量乘法

Source§

type Output = Unit<<S as Mul<Si<Var<T>, D, Pr>>>::Output, R>

The resulting type after applying the * operator.
Source§

impl<T, D, Pr> Mul<T> for Si<Var<T>, D, Pr>
where T: Numeric, Var<T>: Scalar + Mul<Var<T>, Output: Scalar>, D: Dimensional, Pr: Prefixed,

Source§

fn mul(self, rhs: T) -> Self::Output

乘法(量纲、前缀不变)

Source§

type Output = Si<<Var<T> as Mul>::Output, D, Pr>

The resulting type after applying the * operator.
Source§

impl<S, R, T, D, Pr> Mul<Unit<S, R>> for Si<Var<T>, D, Pr>
where T: Numeric, Var<T>: Scalar, D: Dimensional, Pr: Prefixed, S: Sied + Mul<Si<Var<T>, D, Pr>, Output: Sied>, Si<Var<T>, D, Pr>: Sied, R: Scaled,

Source§

fn mul(self, rhs: Unit<S, R>) -> Self::Output

物理量乘法

Source§

type Output = Unit<<S as Mul<Si<Var<T>, D, Pr>>>::Output, R>

The resulting type after applying the * operator.
Source§

impl<T, D, Pr> Mul<Var<T>> for Si<Var<T>, D, Pr>
where T: Numeric, Var<T>: Scalar + Mul<Var<T>, Output: Scalar>, D: Dimensional, Pr: Prefixed,

Source§

fn mul(self, rhs: Var<T>) -> Self::Output

乘法(量纲、前缀不变)

Source§

type Output = Si<<Var<T> as Mul>::Output, D, Pr>

The resulting type after applying the * operator.
Source§

impl<T, D, Pr> MulAssign<T> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + MulAssign<Var<T>>,

Source§

fn mul_assign(&mut self, rhs: T)

标量乘法赋值 (*=)

Source§

impl<T, D, Pr> MulAssign<Var<T>> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + MulAssign<Var<T>>,

Source§

fn mul_assign(&mut self, rhs: Var<T>)

Performs the *= operation. Read more
Source§

impl<V, D: Dimensional, Pr: Prefixed> Neg for Si<V, D, Pr>
where V: Neg<Output = V> + Scalar,

Source§

fn neg(self) -> Self::Output

取负运算(保持前缀和量纲不变)

Source§

type Output = Si<V, D, Pr>

The resulting type after applying the - operator.
Source§

impl<V, D, Pr> Sub for Si<V, D, Pr>
where V: Scalar + Sub<V, Output = V>, D: Dimensional, Pr: Prefixed,

Source§

fn sub(self, rhs: Self) -> Self::Output

减法(要求相同前缀和量纲)

Source§

type Output = Si<V, D, Pr>

The resulting type after applying the - operator.
Source§

impl<T, D, Pr> SubAssign<T> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + SubAssign<Var<T>>,

Source§

fn sub_assign(&mut self, rhs: T)

标量加法赋值 (+=)

Source§

impl<T, D, Pr> SubAssign<Var<T>> for Si<Var<T>, D, Pr>
where T: Numeric, D: Dimensional, Pr: Prefixed, Var<T>: Scalar + SubAssign<Var<T>>,

Source§

fn sub_assign(&mut self, rhs: Var<T>)

Performs the -= operation. Read more
Source§

impl<V, D: Dimensional, Pr: Prefixed> SubAssign for Si<V, D, Pr>
where V: SubAssign<V> + Scalar,

Source§

fn sub_assign(&mut self, rhs: Self)

减法赋值(要求相同前缀和量纲)

Source§

impl<Value: Copy + Scalar, D: Copy + Dimensional, Pr: Copy + Prefixed> Copy for Si<Value, D, Pr>

Source§

impl<V: Scalar, Pr: Prefixed, D: Dimensional> Sied for Si<V, D, Pr>

Source§

impl<V: Scalar, Pr: Prefixed, D: Dimensional> Unitary for Si<V, D, Pr>

Auto Trait Implementations§

§

impl<Value, D, Pr> Freeze for Si<Value, D, Pr>
where Value: Freeze,

§

impl<Value, D, Pr> RefUnwindSafe for Si<Value, D, Pr>

§

impl<Value, D, Pr> Send for Si<Value, D, Pr>
where Value: Send, D: Send, Pr: Send,

§

impl<Value, D, Pr> Sync for Si<Value, D, Pr>
where Value: Sync, D: Sync, Pr: Sync,

§

impl<Value, D, Pr> Unpin for Si<Value, D, Pr>
where Value: Unpin, D: Unpin, Pr: Unpin,

§

impl<Value, D, Pr> UnwindSafe for Si<Value, D, Pr>
where Value: UnwindSafe, D: UnwindSafe, Pr: UnwindSafe,

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, 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.