Struct geo_aid::script::unroll::CompileContext
source · 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
impl CompileContext
pub fn new() -> Self
pub fn push_error(&self, err: Error)
pub fn ok<T>(&self, res: Result<T, Error>) -> Option<T>
pub fn take_errors(&mut self) -> Vec<Error>
pub fn extend_errors<I: IntoIterator<Item = Error>>(&self, iter: I)
pub fn valid(&self) -> bool
pub fn push_rule(&self, rule: UnrolledRule)
pub fn take_rules(&mut self) -> Vec<UnrolledRule>
sourcepub fn get_entity(&self, i: usize) -> &Entity
pub fn get_entity(&self, i: usize) -> &Entity
Gets the entity of the given index.
sourcepub fn get_entity_mut(&mut self, i: usize) -> &mut Entity
pub fn get_entity_mut(&mut self, i: usize) -> &mut Entity
Gets the entity of the given index.
pub fn add_scalar(&mut self) -> usize
pub fn add_point(&mut self) -> usize
sourcepub fn get_point_by_index(&self, index: usize) -> Expr<UnrolledPoint>
pub fn get_point_by_index(&self, index: usize) -> Expr<UnrolledPoint>
Panics
Panics if given an invalid entity.
pub fn get_point_entity_mut( &mut self, expr: &Expr<UnrolledPoint> ) -> Option<&mut Point>
pub fn get_point_entity(&self, expr: &Expr<UnrolledPoint>) -> Option<&Point>
pub fn add_circle(&mut self) -> usize
sourcepub fn get_circle_by_index(&self, index: usize) -> Expr<UnrolledCircle>
pub fn get_circle_by_index(&self, index: usize) -> Expr<UnrolledCircle>
Panics
Panics if given an invalid expression.
sourcepub fn get_line_by_index(&self, index: usize) -> Expr<UnrolledLine>
pub fn get_line_by_index(&self, index: usize) -> Expr<UnrolledLine>
Panics
Panics if given an invalid expression.
source§impl CompileContext
impl CompileContext
Everything related to circles.
pub fn point_on_circle( &mut self, lhs: &Expr<UnrolledPoint>, rhs: &Expr<UnrolledCircle> )
pub fn point_on_line( &mut self, lhs: &Expr<UnrolledPoint>, rhs: &Expr<UnrolledLine> )
source§impl CompileContext
impl CompileContext
pub fn expr_with<T: Displayed>(
&self,
content: T,
display: Properties,
nodes: Vec<Box<dyn Node>>
) -> Expr<T>where
T::Node: FromExpr<T>,
pub fn average_p_display( &self, points: Vec<Expr<UnrolledPoint>>, display: Properties ) -> Expr<UnrolledPoint>
pub fn average_p(&self, points: Vec<Expr<UnrolledPoint>>) -> Expr<UnrolledPoint>
pub fn average_s_display( &self, values: Vec<Expr<UnrolledScalar>>, display: Properties ) -> Expr<UnrolledScalar>
pub fn average_s( &self, points: Vec<Expr<UnrolledScalar>> ) -> Expr<UnrolledScalar>
pub fn entity_p(&self, index: usize) -> Expr<UnrolledPoint>
pub fn entity_s(&self, index: usize, unit: ComplexUnit) -> Expr<UnrolledScalar>
pub fn set_unit_display( &self, v: Expr<UnrolledScalar>, unit: ComplexUnit, display: Properties ) -> Expr<UnrolledScalar>
pub fn set_unit( &self, v: Expr<UnrolledScalar>, unit: ComplexUnit ) -> Expr<UnrolledScalar>
pub fn intersection_display( &self, k: Expr<Line>, l: Expr<Line>, display: Properties ) -> Expr<Point>
pub fn intersection(&self, k: Expr<Line>, l: Expr<Line>) -> Expr<Point>
pub fn distance_pp_display( &self, p: Expr<Point>, q: Expr<Point>, display: Properties ) -> Expr<Scalar>
pub fn distance_pp(&self, p: Expr<Point>, q: Expr<Point>) -> Expr<Scalar>
pub fn distance_pl_display( &self, p: Expr<Point>, k: Expr<Line>, display: Properties ) -> Expr<Scalar>
pub fn distance_pl(&self, p: Expr<Point>, k: Expr<Line>) -> Expr<Scalar>
pub fn circle_center_display( &self, c: Expr<Circle>, display: Properties ) -> Expr<Point>
pub fn circle_center(&self, c: Expr<Circle>) -> Expr<Point>
pub fn circle_radius_display( &self, c: Expr<Circle>, display: Properties ) -> Expr<Scalar>
pub fn circle_radius(&self, c: Expr<Circle>) -> Expr<Scalar>
pub fn line_display( &self, a: Expr<Point>, b: Expr<Point>, display: Properties ) -> Expr<Line>
pub fn line(&self, a: Expr<Point>, b: Expr<Point>) -> Expr<Line>
pub fn angle_ppp_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Scalar>
pub fn angle_ppp( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Scalar>
pub fn angle_dir_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Scalar>
pub fn angle_dir( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Scalar>
pub fn angle_ll_display( &self, k: Expr<Line>, l: Expr<Line>, display: Properties ) -> Expr<Scalar>
pub fn angle_ll(&self, k: Expr<Line>, l: Expr<Line>) -> Expr<Scalar>
pub fn bisector_ppp_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties ) -> Expr<Line>
pub fn bisector_ppp( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point> ) -> Expr<Line>
pub fn perpendicular_through_display( &self, line: Expr<Line>, point: Expr<Point>, display: Properties ) -> Expr<Line>
pub fn perpendicular_through( &self, line: Expr<Line>, point: Expr<Point> ) -> Expr<Line>
pub fn parallel_through_display( &self, line: Expr<Line>, point: Expr<Point>, display: Properties ) -> Expr<Line>
pub fn parallel_through( &self, line: Expr<Line>, point: Expr<Point> ) -> Expr<Line>
pub fn circle_display( &self, center: Expr<Point>, radius: Expr<Scalar>, display: Properties ) -> Expr<Circle>
pub fn circle(&self, center: Expr<Point>, radius: Expr<Scalar>) -> Expr<Circle>
pub fn add_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>
pub fn add(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>
pub fn sub_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>
pub fn sub(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>
pub fn mult_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>
pub fn mult(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>
pub fn div_display( &self, a: Expr<Scalar>, b: Expr<Scalar>, display: Properties ) -> Expr<Scalar>
pub fn div(&self, a: Expr<Scalar>, b: Expr<Scalar>) -> Expr<Scalar>
source§impl CompileContext
impl CompileContext
pub fn scalar_eq_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>
pub fn scalar_eq( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>
pub fn point_eq_display( &mut self, lhs: Expr<Point>, rhs: Expr<Point>, inverted: bool, display: Properties ) -> Box<dyn Node>
pub fn point_eq( &mut self, lhs: Expr<Point>, rhs: Expr<Point>, inverted: bool ) -> Box<dyn Node>
pub fn gt_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>
pub fn gt( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>
pub fn lt_display( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool, display: Properties ) -> Box<dyn Node>
pub fn lt( &mut self, lhs: Expr<Scalar>, rhs: Expr<Scalar>, inverted: bool ) -> Box<dyn Node>
Trait Implementations§
source§impl Debug for CompileContext
impl Debug for CompileContext
Auto Trait Implementations§
impl !RefUnwindSafe for CompileContext
impl !Send for CompileContext
impl !Sync for CompileContext
impl Unpin for CompileContext
impl !UnwindSafe for CompileContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Convert for T
impl<T> Convert for T
source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Errors Read more
source§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Errors Read more