Skip to main content

Time

Struct Time 

Source
pub struct Time(/* private fields */);
Expand description

Time [s].

Implementations§

Source§

impl Time

Source

pub fn seconds(val: &Ex) -> Self

Create a Time from a value in seconds (SI base unit).

Source

pub fn milliseconds(val: &Ex) -> Self

Create a Time from a value in milliseconds.

Source

pub fn microseconds(val: &Ex) -> Self

Create a Time from a value in microseconds.

Source

pub fn nanoseconds(val: &Ex) -> Self

Create a Time from a value in nanoseconds.

Source

pub fn minutes(val: &Ex) -> Self

Create a Time from a value in minutes (1 min = 60 s).

Source

pub fn hours(val: &Ex) -> Self

Create a Time from a value in hours (1 h = 3600 s).

Source

pub fn days(val: &Ex) -> Self

Create a Time from a value in days (1 d = 86400 s).

Source§

impl Time

Source

pub fn from_ex(ex: impl IntoEx) -> Self

Create from a symbolic expression (or anything that implements IntoEx).

Source

pub fn checked_from_ex(ex: impl IntoEx, dims: &DimMap) -> Result<Self, String>

Create from a symbolic expression with runtime dimension validation.

Checks that the expression’s inferred dimension matches this type’s dimension using the provided DimMap. Returns an error if the dimensions don’t match.

Use this instead of from_ex when you want runtime validation of dimensional correctness (e.g., in tests or debug builds).

Source

pub fn symbol(ctx: &Context, name: &str) -> Self

Create a named symbolic variable with this dimension.

Source

pub fn constant(ctx: &Context, val: i64) -> Self

Create from an integer constant.

Source

pub fn rational(ctx: &Context, p: i64, q: i64) -> Self

Create from a rational constant.

Source

pub fn zero(ctx: &Context) -> Self

Zero value.

Source

pub fn into_inner(self) -> Ex

Escape hatch: drop dimension, return raw Ex.

Source

pub fn inner(&self) -> &Ex

Borrow the inner Ex.

Source

pub fn as_qty(self) -> Qty<TimeDim>

Convert to generic Qty<D>.

Source

pub fn dim_name_str() -> &'static str

Runtime dimension name.

Source

pub fn dim_symbol_str() -> &'static str

Runtime dimension symbol.

Source

pub fn simplify(&self) -> Self

Apply simplify, preserving dimension.

Source

pub fn expand(&self) -> Self

Apply expand, preserving dimension.

Source

pub fn eval(&self) -> Self

Apply eval, preserving dimension.

Source

pub fn subs(&self, var: &impl AsRef<Ex>, val: &impl AsRef<Ex>) -> Self

Substitute a variable.

Source

pub fn simplify_full(&self) -> Self

Full multi-pass simplification, preserving dimension.

Source

pub fn simplify_trig(&self) -> Self

Trigonometric simplification, preserving dimension.

Source

pub fn simplify_powers(&self) -> Self

Power/exponent simplification, preserving dimension.

Source

pub fn simplify_rational(&self) -> Self

Rational simplification, preserving dimension.

Source

pub fn expand_trig(&self) -> Self

Expand trigonometric identities, preserving dimension.

Source

pub fn expand_log(&self) -> Self

Expand logarithmic identities, preserving dimension.

Source

pub fn log_combine(&self) -> Self

Combine logarithmic terms, preserving dimension.

Source

pub fn trig_combine(&self) -> Self

Combine trigonometric terms, preserving dimension.

Source

pub fn factor(&self, var: &impl AsRef<Ex>) -> Self

Factor with respect to a variable, preserving dimension.

Source

pub fn collect(&self, var: &impl AsRef<Ex>) -> Self

Collect terms with respect to a variable, preserving dimension.

Source

pub fn cancel(&self, var: &Ex) -> Self

Cancel common factors, preserving dimension.

Source

pub fn together(&self) -> Self

Combine fractions over a common denominator, preserving dimension.

Source

pub fn partial_fractions(&self, var: &impl AsRef<Ex>) -> Self

Partial-fraction decomposition with respect to a variable, preserving dimension.

Source

pub fn rationalize_denom(&self) -> Self

Rationalize the denominator, preserving dimension.

Source

pub fn diff(&self, var: &impl AsRef<Ex>) -> Ex

Differentiate with respect to a variable. Returns raw Ex. Wrap result in the correct output type: Acceleration::from_ex(v.diff(&t))

Source

pub fn integrate(&self, var: &impl AsRef<Ex>) -> Ex

Integrate with respect to a variable. Returns raw Ex.

Source

pub fn to_latex(&self) -> String

Render as LaTeX string.

Source

pub fn free_symbols(&self) -> Vec<Ex>

Free symbols in the expression.

Source

pub fn contains(&self, other: &impl AsRef<Ex>) -> bool

Whether the expression contains a given sub-expression.

Source

pub fn term_count(&self) -> usize

Number of top-level additive terms.

Source

pub fn count_ops(&self) -> usize

Count of internal operations.

Source

pub fn is_zero(&self) -> bool

Check whether this quantity is provably zero.

Source

pub fn equals(&self, other: &Self) -> bool

Check symbolic equality with another quantity of the same type.

Source

pub fn eval_f64(&self) -> Result<f64, SymplexError>

Evaluate to f64.

Source

pub fn eval_f64_with(&self, subs: &[(&Ex, i64)]) -> Result<f64, SymplexError>

Substitute integer values and evaluate to f64.

Source

pub fn eval_decimal(&self, digits: u32) -> Result<String, SymplexError>

Evaluate to a decimal string with the given number of digits.

Trait Implementations§

Source§

impl Add for Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Time) -> Time

Performs the + operation. Read more
Source§

impl Add<&Time> for &Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Time) -> Time

Performs the + operation. Read more
Source§

impl Add<&Time> for Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Time) -> Time

Performs the + operation. Read more
Source§

impl Add<Time> for &Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Time) -> Time

Performs the + operation. Read more
Source§

impl AsRef<Expr<Numeric>> for Time

Source§

fn as_ref(&self) -> &Ex

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Time

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Time

Source§

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

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

impl DiffWrt<Time> for Length

Source§

type Output = Velocity

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Velocity

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for Velocity

Source§

type Output = Acceleration

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Acceleration

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for Angle

Source§

type Output = AngularVelocity

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> AngularVelocity

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for AngularVelocity

Source§

type Output = AngularAcceleration

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> AngularAcceleration

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for Energy

Source§

type Output = Power

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Power

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for Momentum

Source§

type Output = Force

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Force

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for AngularMomentum

Source§

type Output = Torque

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Torque

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for Charge

Source§

type Output = Current

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Current

Differentiate this quantity with respect to the given variable.
Source§

impl DiffWrt<Time> for MagneticFlux

Source§

type Output = Voltage

The output quantity type after differentiation.
Source§

fn diff_wrt(&self, var: &Time) -> Voltage

Differentiate this quantity with respect to the given variable.
Source§

impl Display for Time

Source§

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

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

impl Div<i64> for Time

Source§

type Output = Time

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i64) -> Time

Performs the / operation. Read more
Source§

impl From<Qty<Dim<Z0, Z0, PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0>>> for Time

Source§

fn from(q: Qty<TimeDim>) -> Time

Converts to this type from the input type.
Source§

impl From<Time> for Qty<TimeDim>

Source§

fn from(q: Time) -> Qty<TimeDim>

Converts to this type from the input type.
Source§

impl FromDimExpr<Dim<Z0, Z0, PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0>> for Time

Source§

fn from_dim_expr(qty: Qty<TimeDim>) -> Self

Convert from a generic Qty with the matching dimension.
Source§

impl IntWrt<Time> for Velocity

Source§

type Output = Length

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Length

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Acceleration

Source§

type Output = Velocity

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Velocity

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for AngularVelocity

Source§

type Output = Angle

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Angle

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for AngularAcceleration

Source§

type Output = AngularVelocity

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> AngularVelocity

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Power

Source§

type Output = Energy

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Energy

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Force

Source§

type Output = Momentum

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Momentum

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Torque

Source§

type Output = AngularMomentum

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> AngularMomentum

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Current

Source§

type Output = Charge

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> Charge

Integrate this quantity with respect to the given variable.
Source§

impl IntWrt<Time> for Voltage

Source§

type Output = MagneticFlux

The output quantity type after integration.
Source§

fn integrate_wrt(&self, var: &Time) -> MagneticFlux

Integrate this quantity with respect to the given variable.
Source§

impl Mul<&Expr<Numeric>> for Time

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Ex) -> Time

Performs the * operation. Read more
Source§

impl Mul<&Expr<Numeric>> for &Time

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Ex) -> Time

Performs the * operation. Read more
Source§

impl Mul<&Time> for i64

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Time) -> Time

Performs the * operation. Read more
Source§

impl Mul<Time> for i64

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Time) -> Time

Performs the * operation. Read more
Source§

impl Mul<Time> for &Ex

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Time) -> Time

Performs the * operation. Read more
Source§

impl Mul<i64> for Time

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i64) -> Time

Performs the * operation. Read more
Source§

impl Mul<i64> for &Time

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i64) -> Time

Performs the * operation. Read more
Source§

impl Neg for Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn neg(self) -> Time

Performs the unary - operation. Read more
Source§

impl Neg for &Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn neg(self) -> Time

Performs the unary - operation. Read more
Source§

impl Sub for Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Time) -> Time

Performs the - operation. Read more
Source§

impl Sub<&Time> for &Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Time) -> Time

Performs the - operation. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Time

§

impl !UnwindSafe for Time

§

impl Freeze for Time

§

impl Send for Time

§

impl Sync for Time

§

impl Unpin for Time

§

impl UnsafeUnpin for Time

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more