Skip to main content

Scale

Struct Scale 

Source
pub struct Scale {
    pub name: String,
    pub residues: ResidueType,
    pub much_smaller_than: Option<Arc<Scale>>,
    pub much_larger_than: Option<Arc<Scale>>,
    pub refines: Option<Arc<Scale>>,
}
Expand description

An infinitesimal of the program: the name it was declared under, what is known about the residues of its reciprocal, the infinite natural ⌈1/dt⌉, and where it stands among the others.

dx declared much smaller than dt is smaller than every positive number made from dt, so the two are ordered as levels: every value of dx with coefficients made from dt has the sign of its lowest-order coefficient in dx. A declaration names at most one infinitesimal it is much smaller than and one it is much larger than, and the order of any two is what those statements give by transitivity (Scale::order); two the declarations do not order are never combined.

Fields§

§name: String§residues: ResidueType§much_smaller_than: Option<Arc<Scale>>

The infinitesimal this one was declared much smaller than.

§much_larger_than: Option<Arc<Scale>>

The infinitesimal this one was declared much larger than.

§refines: Option<Arc<Scale>>

The declared infinitesimal this is, read on one residue class of its reciprocal: the engine’s copy for a class keeps the declaration it refines, and is that infinitesimal.

Implementations§

Source§

impl Scale

Source

pub fn new(name: &str, residues: ResidueType) -> Scale

An infinitesimal declared on its own.

Source

pub fn ordered( name: &str, residues: ResidueType, larger: Option<Arc<Scale>>, smaller: Option<Arc<Scale>>, ) -> Result<Scale, String>

An infinitesimal declared much smaller than larger and much larger than smaller, each when given; refused when the bounds are not already ordered, smaller below larger, or when it would share a name with an infinitesimal it is ordered with.

Source

pub fn with_residues(self: &Arc<Scale>, residues: ResidueType) -> Scale

The same infinitesimal on a narrower residue type of its reciprocal.

Source

pub fn same_infinitesimal(&self, o: &Scale) -> bool

Whether the two are one infinitesimal: one declaration, whatever residue class either is read on.

Source

pub fn order(&self, o: &Scale) -> Option<Ordering>

Less when this infinitesimal is much smaller than o, Greater when much larger, Equal for one infinitesimal; None when the declarations do not order them. a is much smaller than b when some infinitesimal reached from a through the ones declared above it is reached from b through the ones declared below it: every declaration states its bounds’ order already known, so no later one orders two earlier ones, and that meeting is the only route.

Source

pub fn unordered(&self, o: &Scale) -> String

The refusal for two infinitesimals whose order the program does not state.

Source

pub fn generator_text(&self) -> String

How the infinite generator is written in a dependence: ⌈1/dt⌉.

Source§

impl Scale

Source

pub fn to_bytes(&self) -> Vec<u8> ⓘ

The declaration’s canonical bytes: the residue type of the reciprocal, and for an infinitesimal declared much smaller or much larger than another, a 1 and each of those two in turn — a 0 for none, or a 1, its name and its own bytes. An infinitesimal declared on its own writes its residue type alone. A residue class’s copy writes the declaration it refines.

Source

pub fn from_bytes(name: &str, bytes: &[u8]) -> Option<Arc<Scale>>

The infinitesimal Scale::to_bytes wrote under name; None for a forged or non-canonical encoding, or a declaration its bounds refuse.

Trait Implementations§

Source§

impl Debug for Scale

Source§

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

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

impl Hash for Scale

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 PartialEq for Scale

Source§

fn eq(&self, other: &Scale) -> 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 Eq for Scale

Source§

impl StructuralPartialEq for Scale

Auto Trait Implementations§

§

impl Freeze for Scale

§

impl RefUnwindSafe for Scale

§

impl Send for Scale

§

impl Sync for Scale

§

impl Unpin for Scale

§

impl UnsafeUnpin for Scale

§

impl UnwindSafe for Scale

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

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

§

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

Checks if this value is equivalent to the given key. Read more
§

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

§

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

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,