Struct Variable

Source
#[repr(C)]
pub struct Variable<T> { /* private fields */ }

Implementations§

Source§

impl<T> Variable<T>

Source

pub fn new() -> Variable<T>

Source

pub fn id(&self) -> AtomicId

Source

pub const fn is_expression(&self) -> bool

Source

pub const fn is_initialized(&self) -> bool

Source

pub fn name(&self) -> &str

Source

pub fn op(&self) -> Option<&Op>

Source

pub fn op_mut(&mut self) -> Option<&mut Op>

Source

pub fn value(&self) -> Option<&T>

Source

pub fn set(&mut self, value: T)

Source

pub fn set_op(&mut self, op: impl Into<Op>)

Source

pub fn with_id(self, id: AtomicId) -> Variable<T>

Source

pub fn with_name(self, name: impl ToString) -> Variable<T>

Source

pub fn with_op(self, op: impl Into<Op>) -> Variable<T>

Source

pub fn with_value(self, value: T) -> Variable<T>

Trait Implementations§

Source§

impl<'a, T> Add<&'a Variable<T>> for Variable<T>
where T: Copy + Default + Add<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the + operator.
Source§

fn add( self, rhs: &'a Variable<T>, ) -> <Variable<T> as Add<&'a Variable<T>>>::Output

Performs the + operation. Read more
Source§

impl<T> Add<T> for Variable<T>
where T: Copy + Default + Add<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> <Variable<T> as Add<T>>::Output

Performs the + operation. Read more
Source§

impl<'a, T> Add<Variable<T>> for &'a Variable<T>
where T: Copy + Default + Add<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Variable<T>) -> <&'a Variable<T> as Add<Variable<T>>>::Output

Performs the + operation. Read more
Source§

impl<'a, T> Add for &'a Variable<T>
where T: Copy + Default + Add<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a Variable<T>) -> <&'a Variable<T> as Add>::Output

Performs the + operation. Read more
Source§

impl<T> Add for Variable<T>
where T: Copy + Default + Add<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Variable<T>) -> <Variable<T> as Add>::Output

Performs the + operation. Read more
Source§

impl<T> Borrow<T> for Variable<T>

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for Variable<T>

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

fn clone(&self) -> Variable<T>

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<T> Debug for Variable<T>
where T: Debug,

Source§

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

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

impl<T> Default for Variable<T>
where T: Default,

Source§

fn default() -> Variable<T>

Returns the “default value” for a type. Read more
Source§

impl<'de, T> Deserialize<'de> for Variable<T>
where T: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Variable<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Display for Variable<T>
where T: Display,

Source§

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

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

impl<'a, T> Div<&'a Variable<T>> for Variable<T>
where T: Copy + Default + Div<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the / operator.
Source§

fn div( self, rhs: &'a Variable<T>, ) -> <Variable<T> as Div<&'a Variable<T>>>::Output

Performs the / operation. Read more
Source§

impl<T> Div<T> for Variable<T>
where T: Copy + Default + Div<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> <Variable<T> as Div<T>>::Output

Performs the / operation. Read more
Source§

impl<'a, T> Div<Variable<T>> for &'a Variable<T>
where T: Copy + Default + Div<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Variable<T>) -> <&'a Variable<T> as Div<Variable<T>>>::Output

Performs the / operation. Read more
Source§

impl<'a, T> Div for &'a Variable<T>
where T: Copy + Default + Div<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Variable<T>) -> <&'a Variable<T> as Div>::Output

Performs the / operation. Read more
Source§

impl<T> Div for Variable<T>
where T: Copy + Default + Div<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Variable<T>) -> <Variable<T> as Div>::Output

Performs the / operation. Read more
Source§

impl<T> Eval for Variable<T>
where T: Copy + Default,

Source§

fn eval(&self) -> <Variable<T> as EvalOnce>::Output

Source§

impl<T> EvalMut for Variable<T>
where T: Default,

Source§

fn eval_mut(&mut self) -> <Variable<T> as EvalOnce>::Output

Source§

impl<T> EvalOnce for Variable<T>
where T: Default,

Source§

impl<T> Gradient<Variable<T>> for Variable<T>
where T: Num,

Source§

type Gradient = T

Source§

fn grad( &self, args: Variable<T>, ) -> <Variable<T> as Gradient<Variable<T>>>::Gradient

Source§

impl<T> Hash for Variable<T>
where T: Hash,

Source§

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

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<'a, T> Mul<&'a Variable<T>> for Variable<T>
where T: Copy + Default + Mul<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the * operator.
Source§

fn mul( self, rhs: &'a Variable<T>, ) -> <Variable<T> as Mul<&'a Variable<T>>>::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for Variable<T>
where T: Copy + Default + Mul<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> <Variable<T> as Mul<T>>::Output

Performs the * operation. Read more
Source§

impl<'a, T> Mul<Variable<T>> for &'a Variable<T>
where T: Copy + Default + Mul<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Variable<T>) -> <&'a Variable<T> as Mul<Variable<T>>>::Output

Performs the * operation. Read more
Source§

impl<'a, T> Mul for &'a Variable<T>
where T: Copy + Default + Mul<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Variable<T>) -> <&'a Variable<T> as Mul>::Output

Performs the * operation. Read more
Source§

impl<T> Mul for Variable<T>
where T: Copy + Default + Mul<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Variable<T>) -> <Variable<T> as Mul>::Output

Performs the * operation. Read more
Source§

impl<'a, T> Neg for &'a Variable<T>
where T: Copy + Default + Neg<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&'a Variable<T> as Neg>::Output

Performs the unary - operation. Read more
Source§

impl<T> Neg for Variable<T>
where T: Copy + Default + Neg<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <Variable<T> as Neg>::Output

Performs the unary - operation. Read more
Source§

impl<T> Not for Variable<T>
where T: Copy + Default + Not<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> <Variable<T> as Not>::Output

Performs the unary ! operation. Read more
Source§

impl<T> Num for Variable<T>
where T: Copy + Default + Num,

Source§

type FromStrRadixErr = <T as Num>::FromStrRadixErr

Source§

fn from_str_radix( str: &str, radix: u32, ) -> Result<Variable<T>, <Variable<T> as Num>::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
Source§

impl<T> One for Variable<T>
where T: Copy + Default + One,

Source§

fn one() -> Variable<T>

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl<T> Ord for Variable<T>
where T: Ord,

Source§

fn cmp(&self, other: &Variable<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Variable<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Variable<T>) -> 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<T> PartialOrd for Variable<T>
where T: PartialOrd,

Source§

fn partial_cmp(&self, other: &Variable<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, T> Rem<&'a Variable<T>> for Variable<T>
where T: Copy + Default + Rem<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the % operator.
Source§

fn rem( self, rhs: &'a Variable<T>, ) -> <Variable<T> as Rem<&'a Variable<T>>>::Output

Performs the % operation. Read more
Source§

impl<T> Rem<T> for Variable<T>
where T: Copy + Default + Rem<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> <Variable<T> as Rem<T>>::Output

Performs the % operation. Read more
Source§

impl<'a, T> Rem<Variable<T>> for &'a Variable<T>
where T: Copy + Default + Rem<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Variable<T>) -> <&'a Variable<T> as Rem<Variable<T>>>::Output

Performs the % operation. Read more
Source§

impl<'a, T> Rem for &'a Variable<T>
where T: Copy + Default + Rem<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Variable<T>) -> <&'a Variable<T> as Rem>::Output

Performs the % operation. Read more
Source§

impl<T> Rem for Variable<T>
where T: Copy + Default + Rem<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Variable<T>) -> <Variable<T> as Rem>::Output

Performs the % operation. Read more
Source§

impl<T> Serialize for Variable<T>
where T: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a, T> Sub<&'a Variable<T>> for Variable<T>
where T: Copy + Default + Sub<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn sub( self, rhs: &'a Variable<T>, ) -> <Variable<T> as Sub<&'a Variable<T>>>::Output

Performs the - operation. Read more
Source§

impl<T> Sub<T> for Variable<T>
where T: Copy + Default + Sub<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> <Variable<T> as Sub<T>>::Output

Performs the - operation. Read more
Source§

impl<'a, T> Sub<Variable<T>> for &'a Variable<T>
where T: Copy + Default + Sub<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Variable<T>) -> <&'a Variable<T> as Sub<Variable<T>>>::Output

Performs the - operation. Read more
Source§

impl<'a, T> Sub for &'a Variable<T>
where T: Copy + Default + Sub<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Variable<T>) -> <&'a Variable<T> as Sub>::Output

Performs the - operation. Read more
Source§

impl<T> Sub for Variable<T>
where T: Copy + Default + Sub<Output = T>,

Source§

type Output = Variable<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Variable<T>) -> <Variable<T> as Sub>::Output

Performs the - operation. Read more
Source§

impl<T> Zero for Variable<T>
where T: Copy + Default + Zero,

Source§

fn zero() -> Variable<T>

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T> Eq for Variable<T>
where T: Eq,

Source§

impl<T> Send for Variable<T>

Source§

impl<T> StructuralPartialEq for Variable<T>

Source§

impl<T> Sync for Variable<T>

Auto Trait Implementations§

§

impl<T> Freeze for Variable<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Variable<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for Variable<T>
where T: Unpin,

§

impl<T> UnwindSafe for Variable<T>
where T: 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<K, Q> Id<K> for Q
where K: Identifier, Q: Borrow<K>,

Source§

type Q = Q

Source§

fn from_id(id: <Q as Id<K>>::Q) -> Q

Source§

fn get(&self) -> &<Q as Id<K>>::Q

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<S, F> IntoOp<F> for S
where F: Operator, S: Into<F>,

Source§

fn into_op(self) -> F

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<M> Measure for M
where M: Debug + PartialOrd + Add<Output = M> + Default + Clone,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,