pub struct CompileContext {
    pub variables: HashMap<String, AnyExpr>,
    pub flags: FlagSet,
    pub entities: Vec<Entity>,
    pub rules: RefCell<Vec<UnrolledRule>>,
    /* private fields */
}
Expand description

The context of compilation process.

Fields§

§variables: HashMap<String, AnyExpr>

Variables

§flags: FlagSet

Flags

§entities: Vec<Entity>

Entities (primitives).

§rules: RefCell<Vec<UnrolledRule>>

Unrolled rules

Implementations§

source§

impl CompileContext

source

pub fn new() -> Self

source

pub fn push_error(&self, err: Error)

source

pub fn ok<T>(&self, res: Result<T, Error>) -> Option<T>

source

pub fn take_errors(&mut self) -> Vec<Error>

source

pub fn extend_errors<I: IntoIterator<Item = Error>>(&self, iter: I)

source

pub fn valid(&self) -> bool

source

pub fn push_rule(&self, rule: UnrolledRule)

source

pub fn take_rules(&mut self) -> Vec<UnrolledRule>

source

pub fn get_entity(&self, i: usize) -> &Entity

Gets the entity of the given index.

source

pub fn get_entity_mut(&mut self, i: usize) -> &mut Entity

Gets the entity of the given index.

source

pub fn add_scalar(&mut self) -> usize

source

pub fn add_point(&mut self) -> usize

source

pub fn get_point_by_index(&self, index: usize) -> Expr<UnrolledPoint>

Panics

Panics if given an invalid entity.

source

pub fn get_point_entity_mut( &mut self, expr: &Expr<UnrolledPoint> ) -> Option<&mut Point>

source

pub fn get_point_entity(&self, expr: &Expr<UnrolledPoint>) -> Option<&Point>

source

pub fn add_circle(&mut self) -> usize

source

pub fn get_circle_by_index(&self, index: usize) -> Expr<UnrolledCircle>

Panics

Panics if given an invalid expression.

source

pub fn get_line_by_index(&self, index: usize) -> Expr<UnrolledLine>

Panics

Panics if given an invalid expression.

source§

impl CompileContext

Everything related to circles.

source

pub fn point_on_circle( &mut self, lhs: &Expr<UnrolledPoint>, rhs: &Expr<UnrolledCircle> )

source

pub fn point_on_line( &mut self, lhs: &Expr<UnrolledPoint>, rhs: &Expr<UnrolledLine> )

source§

impl CompileContext

source

pub fn expr_with<T: Displayed>( &self, content: T, display: Properties, nodes: Vec<Box<dyn Node>> ) -> Expr<T>
where T::Node: FromExpr<T>,

source

pub fn average_p_display( &self, points: Vec<Expr<UnrolledPoint>>, display: Properties ) -> Expr<UnrolledPoint>

source

pub fn average_p(&self, points: Vec<Expr<UnrolledPoint>>) -> Expr<UnrolledPoint>

source

pub fn average_s_display( &self, values: Vec<Expr<UnrolledScalar>>, display: Properties ) -> Expr<UnrolledScalar>

source

pub fn average_s( &self, points: Vec<Expr<UnrolledScalar>> ) -> Expr<UnrolledScalar>

source

pub fn entity_p(&self, index: usize) -> Expr<UnrolledPoint>

source

pub fn entity_s(&self, index: usize, unit: ComplexUnit) -> Expr<UnrolledScalar>

source

pub fn set_unit_display( &self, v: Expr<UnrolledScalar>, unit: ComplexUnit, display: Properties ) -> Expr<UnrolledScalar>

source

pub fn set_unit( &self, v: Expr<UnrolledScalar>, unit: ComplexUnit ) -> Expr<UnrolledScalar>

source

pub fn intersection_display( &self, k: Expr<Line>, l: Expr<Line>, display: Properties ) -> Expr<Point>

source

pub fn intersection(&self, k: Expr<Line>, l: Expr<Line>) -> Expr<Point>

source

pub fn distance_pp_display( &self, p: Expr<Point>, q: Expr<Point>, display: Properties ) -> Expr<Scalar>

source

pub fn distance_pp(&self, p: Expr<Point>, q: Expr<Point>) -> Expr<Scalar>

source

pub fn distance_pl_display( &self, p: Expr<Point>, k: Expr<Line>, display: Properties ) -> Expr<Scalar>

source

pub fn distance_pl(&self, p: Expr<Point>, k: Expr<Line>) -> Expr<Scalar>

source

pub fn circle_center_display( &self, c: Expr<Circle>, display: Properties ) -> Expr<Point>

source

pub fn circle_center(&self, c: Expr<Circle>) -> Expr<Point>

source

pub fn circle_radius_display( &self, c: Expr<Circle>, display: Properties ) -> Expr<Scalar>

source

pub fn circle_radius(&self, c: Expr<Circle>) -> Expr<Scalar>

source

pub fn line_display( &self, a: Expr<Point>, b: Expr<Point>, display: Properties ) -> Expr<Line>

source

pub fn line(&self, a: Expr<Point>, b: Expr<Point>) -> Expr<Line>

source

pub fn angle_ppp_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Scalar>

source

pub fn angle_ppp( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Scalar>

source

pub fn angle_dir_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Scalar>

source

pub fn angle_dir( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Scalar>

source

pub fn angle_ll_display( &self, k: Expr<Line>, l: Expr<Line>, display: Properties ) -> Expr<Scalar>

source

pub fn angle_ll(&self, k: Expr<Line>, l: Expr<Line>) -> Expr<Scalar>

source

pub fn bisector_ppp_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Line>

source

pub fn bisector_ppp( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Line>

source

pub fn perpendicular_through_display( &self, line: Expr<Line>, point: Expr<Point>, display: Properties ) -> Expr<Line>

source

pub fn perpendicular_through( &self, line: Expr<Line>, point: Expr<Point> ) -> Expr<Line>

source

pub fn parallel_through_display( &self, line: Expr<Line>, point: Expr<Point>, display: Properties ) -> Expr<Line>

source

pub fn parallel_through( &self, line: Expr<Line>, point: Expr<Point> ) -> Expr<Line>

source

pub fn circle_display( &self, center: Expr<Point>, radius: Expr<Scalar>, display: Properties ) -> Expr<Circle>

source

pub fn circle(&self, center: Expr<Point>, radius: Expr<Scalar>) -> Expr<Circle>

source

pub fn add_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>

source

pub fn add(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>

source

pub fn sub_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>

source

pub fn sub(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>

source

pub fn mult_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>

source

pub fn mult(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>

source

pub fn div_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>

source

pub fn div(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>

source§

impl CompileContext

source

pub fn scalar_eq_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>

source

pub fn scalar_eq( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>

source

pub fn point_eq_display( &mut self, lhs: Expr<Point>, rhs: Expr<Point>, inverted: bool, display: Properties ) -> Box<dyn Node>

source

pub fn point_eq( &mut self, lhs: Expr<Point>, rhs: Expr<Point>, inverted: bool ) -> Box<dyn Node>

source

pub fn gt_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>

source

pub fn gt( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>

source

pub fn lt_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>

source

pub fn lt( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>

Trait Implementations§

source§

impl Debug for CompileContext

source§

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

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

impl Default for CompileContext

source§

fn default() -> Self

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

Auto Trait Implementations§

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

source§

fn convert<U>(self, context: &CompileContext) -> Expr<U>
where U: ConvertFrom<T>,

Errors Read more
source§

fn can_convert<U>(&self) -> bool
where U: ConvertFrom<T>,

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

§

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

§

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