pub struct CompileContext {
pub variables: HashMap<String, AnyExpr>,
pub flags: FlagSet,
pub rules: RefCell<Vec<UnrolledRule>>,
/* private fields */
}
Expand description
The context of unroll process.
Fields§
§variables: HashMap<String, AnyExpr>
Variables. AnyExpr
is expected to be the variable variant.
flags: FlagSet
Flags
rules: RefCell<Vec<UnrolledRule>>
Unrolled rules
Implementations§
Source§impl CompileContext
impl CompileContext
Sourcepub fn push_error(&self, err: Error)
pub fn push_error(&self, err: Error)
Push an error.
Sourcepub fn ok<T>(&self, res: Result<T, Error>) -> Option<T>
pub fn ok<T>(&self, res: Result<T, Error>) -> Option<T>
Turn a Result
into an Option
while pushing the error if present.
Sourcepub fn take_errors(&mut self) -> Vec<Error>
pub fn take_errors(&mut self) -> Vec<Error>
Take the context’s errors.
Sourcepub fn extend_errors<I: IntoIterator<Item = Error>>(&self, iter: I)
pub fn extend_errors<I: IntoIterator<Item = Error>>(&self, iter: I)
Extend the context’s errors
Sourcepub fn push_rule(&self, rule: UnrolledRule)
pub fn push_rule(&self, rule: UnrolledRule)
Push a rule.
Sourcepub fn take_rules(&mut self) -> Vec<UnrolledRule>
pub fn take_rules(&mut self) -> Vec<UnrolledRule>
Take the context’s rules.
Source§impl CompileContext
Everything related to circles.
impl CompileContext
Everything related to circles.
Source§impl CompileContext
impl CompileContext
Sourcepub fn expr_with<T: Displayed>(
&self,
content: T,
display: Properties,
nodes: Vec<Box<dyn Node>>,
) -> Expr<T>
pub fn expr_with<T: Displayed>( &self, content: T, display: Properties, nodes: Vec<Box<dyn Node>>, ) -> Expr<T>
Create an expression with properties and nodes.
Sourcepub fn average_p_display(
&self,
points: Vec<Expr<Point>>,
display: Properties,
) -> Expr<Point>
pub fn average_p_display( &self, points: Vec<Expr<Point>>, display: Properties, ) -> Expr<Point>
An average pointe expression with display options.
Sourcepub fn average_p(&self, points: Vec<Expr<Point>>) -> Expr<Point>
pub fn average_p(&self, points: Vec<Expr<Point>>) -> Expr<Point>
Average point expression with no properties.
Sourcepub fn average_s_display(
&self,
values: Vec<Expr<Number>>,
display: Properties,
) -> Expr<Number>
pub fn average_s_display( &self, values: Vec<Expr<Number>>, display: Properties, ) -> Expr<Number>
Average scalar expression with display options.
Sourcepub fn average_s(&self, points: Vec<Expr<Number>>) -> Expr<Number>
pub fn average_s(&self, points: Vec<Expr<Number>>) -> Expr<Number>
Average scalar expression with no properties.
Sourcepub fn set_unit_display(
&self,
v: Expr<Number>,
unit: ComplexUnit,
display: Properties,
) -> Expr<Number>
pub fn set_unit_display( &self, v: Expr<Number>, unit: ComplexUnit, display: Properties, ) -> Expr<Number>
Set unit expression with properties.
Sourcepub fn set_unit(&self, v: Expr<Number>, unit: ComplexUnit) -> Expr<Number>
pub fn set_unit(&self, v: Expr<Number>, unit: ComplexUnit) -> Expr<Number>
Set unit expression with no properties.
Sourcepub fn free_point_display(&self, display: Properties) -> Expr<Point>
pub fn free_point_display(&self, display: Properties) -> Expr<Point>
Free point expression with properties.
Sourcepub fn free_point(&self) -> Expr<Point>
pub fn free_point(&self) -> Expr<Point>
Free point expression with no properties.
Sourcepub fn free_scalar_display(&self, display: Properties) -> Expr<Number>
pub fn free_scalar_display(&self, display: Properties) -> Expr<Number>
Free scalar expression with properties.
Sourcepub fn free_scalar(&self) -> Expr<Number>
pub fn free_scalar(&self) -> Expr<Number>
Free scalar expression with no properties.
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<Number>
pub fn distance_pp(&self, p: Expr<Point>, q: Expr<Point>) -> Expr<Number>
pub fn distance_pl_display( &self, p: Expr<Point>, k: Expr<Line>, display: Properties, ) -> Expr<Number>
pub fn distance_pl(&self, p: Expr<Point>, k: Expr<Line>) -> Expr<Number>
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<Number>
pub fn circle_radius(&self, c: Expr<Circle>) -> Expr<Number>
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<Number>
pub fn angle_ppp( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, ) -> Expr<Number>
pub fn angle_dir_display( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, display: Properties, ) -> Expr<Number>
pub fn angle_dir( &self, a: Expr<Point>, b: Expr<Point>, c: Expr<Point>, ) -> Expr<Number>
pub fn angle_ll_display( &self, k: Expr<Line>, l: Expr<Line>, display: Properties, ) -> Expr<Number>
pub fn angle_ll(&self, k: Expr<Line>, l: Expr<Line>) -> Expr<Number>
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<Number>, display: Properties, ) -> Expr<Circle>
pub fn circle(&self, center: Expr<Point>, radius: Expr<Number>) -> Expr<Circle>
pub fn add_display( &self, a: Expr<Number>, b: Expr<Number>, display: Properties, ) -> Expr<Number>
pub fn add(&self, a: Expr<Number>, b: Expr<Number>) -> Expr<Number>
pub fn sub_display( &self, a: Expr<Number>, b: Expr<Number>, display: Properties, ) -> Expr<Number>
pub fn sub(&self, a: Expr<Number>, b: Expr<Number>) -> Expr<Number>
pub fn real_display(&self, v: Expr<Number>, display: Properties) -> Expr<Number>
pub fn real(&self, v: Expr<Number>) -> Expr<Number>
pub fn imaginary_display( &self, v: Expr<Number>, display: Properties, ) -> Expr<Number>
pub fn imaginary(&self, v: Expr<Number>) -> Expr<Number>
pub fn to_complex_display( &self, p: Expr<Point>, display: Properties, ) -> Expr<Number>
pub fn to_complex(&self, p: Expr<Point>) -> Expr<Number>
pub fn to_point_display( &self, v: Expr<Number>, display: Properties, ) -> Expr<Point>
pub fn to_point(&self, v: Expr<Number>) -> Expr<Point>
pub fn sin_display(&self, v: Expr<Number>, display: Properties) -> Expr<Number>
pub fn sin(&self, v: Expr<Number>) -> Expr<Number>
pub fn cos_display(&self, v: Expr<Number>, display: Properties) -> Expr<Number>
pub fn cos(&self, v: Expr<Number>) -> Expr<Number>
pub fn log_display(&self, v: Expr<Number>, display: Properties) -> Expr<Number>
pub fn log(&self, v: Expr<Number>) -> Expr<Number>
pub fn direction_display( &self, k: Expr<Line>, display: Properties, ) -> Expr<Number>
pub fn direction(&self, k: Expr<Line>) -> Expr<Number>
pub fn neg_display(&self, v: Expr<Number>, display: Properties) -> Expr<Number>
pub fn neg(&self, v: Expr<Number>) -> Expr<Number>
pub fn point_vector_display( &self, p: Expr<Point>, v: Expr<Number>, display: Properties, ) -> Expr<Line>
pub fn point_vector(&self, p: Expr<Point>, v: Expr<Number>) -> Expr<Line>
pub fn point_x_display( &self, p: Expr<Point>, display: Properties, ) -> Expr<Number>
pub fn point_x(&self, p: Expr<Point>) -> Expr<Number>
pub fn point_y_display( &self, p: Expr<Point>, display: Properties, ) -> Expr<Number>
pub fn point_y(&self, p: Expr<Point>) -> Expr<Number>
pub fn mult_display( &self, a: Expr<Number>, b: Expr<Number>, display: Properties, ) -> Expr<Number>
pub fn mult(&self, a: Expr<Number>, b: Expr<Number>) -> Expr<Number>
pub fn pow_display( &self, v: Expr<Number>, exponent: Ratio<i64>, display: Properties, ) -> Expr<Number>
pub fn pow(&self, v: Expr<Number>, exponent: Ratio<i64>) -> Expr<Number>
pub fn div_display( &self, a: Expr<Number>, b: Expr<Number>, display: Properties, ) -> Expr<Number>
pub fn div(&self, a: Expr<Number>, b: Expr<Number>) -> Expr<Number>
Source§impl CompileContext
impl CompileContext
pub fn scalar_eq_display( &mut self, lhs: Expr<Number>, rhs: Expr<Number>, inverted: bool, display: Properties, ) -> Box<dyn Node>
pub fn scalar_eq( &mut self, lhs: Expr<Number>, rhs: Expr<Number>, 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<Number>, rhs: Expr<Number>, inverted: bool, display: Properties, ) -> Box<dyn Node>
pub fn gt( &mut self, lhs: Expr<Number>, rhs: Expr<Number>, inverted: bool, ) -> Box<dyn Node>
Trait Implementations§
Source§impl Debug for CompileContext
impl Debug for CompileContext
Auto Trait Implementations§
impl !Freeze for CompileContext
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
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>,
self
into a specific type. Read moreSource§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
self
can be converted into a specific type. Read more