pub struct Expr<T: ?Sized + Displayed> {
pub data: Rc<T>,
pub span: Span,
pub node: Option<HierarchyNode<T::Node>>,
}
Fields§
§data: Rc<T>
§span: Span
§node: Option<HierarchyNode<T::Node>>
Implementations§
source§impl Expr<Point>
impl Expr<Point>
pub fn boxed(self, span: Span) -> Self
pub fn x( self, span: Span, display: Properties, context: &CompileContext, ) -> Expr<Scalar>
pub fn y( self, span: Span, display: Properties, context: &CompileContext, ) -> Expr<Scalar>
source§impl Expr<Circle>
impl Expr<Circle>
pub fn boxed(self, span: Span) -> Self
pub fn center( self, span: Span, display: Properties, context: &CompileContext, ) -> Expr<Point>
pub fn radius( self, span: Span, display: Properties, context: &CompileContext, ) -> Expr<Scalar>
source§impl Expr<Scalar>
impl Expr<Scalar>
pub fn boxed(self, span: Span) -> Self
sourcepub fn convert_unit(
self,
unit: Option<ComplexUnit>,
context: &CompileContext,
) -> Self
pub fn convert_unit( self, unit: Option<ComplexUnit>, context: &CompileContext, ) -> Self
§Errors
Returns a conversion error if it is invalid.
Only valid conversions are None to another unit or self to self
sourcepub fn can_convert_unit(&self, unit: Option<ComplexUnit>) -> bool
pub fn can_convert_unit(&self, unit: Option<ComplexUnit>) -> bool
Checks whether a unit conversion can be performed
sourcepub fn specify_unit(self, context: &CompileContext) -> Self
pub fn specify_unit(self, context: &CompileContext) -> Self
§Panics
If bugged
source§impl Expr<PointCollection>
impl Expr<PointCollection>
pub fn make_variable(self, name: String) -> Self
source§impl Expr<PointCollection>
impl Expr<PointCollection>
pub fn boxed(self, span: Span) -> Self
sourcepub fn check_len(self, length: usize, context: &CompileContext) -> Self
pub fn check_len(self, length: usize, context: &CompileContext) -> Self
§Errors
Returns an error if lengths don’t match up.
pub fn index_without_node(&self, index: usize) -> Expr<Point>
sourcepub fn index_with_node(&mut self, index: usize) -> Expr<Point>
pub fn index_with_node(&mut self, index: usize) -> Expr<Point>
Also takes the collection’s node.
source§impl Expr<Bundle>
impl Expr<Bundle>
pub fn boxed(self, span: Span) -> Self
pub fn index_without_node(&self, field: &str) -> AnyExpr
sourcepub fn index_with_node(&mut self, field: &str) -> AnyExpr
pub fn index_with_node(&mut self, field: &str) -> AnyExpr
§Panics
If the given field does not exist.
sourcepub fn check_name(self, name: &'static str, context: &CompileContext) -> Self
pub fn check_name(self, name: &'static str, context: &CompileContext) -> Self
§Errors
Returns an error if the bundle names don’t match
source§impl<T: CloneWithNode + Displayed> Expr<T>
impl<T: CloneWithNode + Displayed> Expr<T>
sourcepub fn new_spanless(data: T) -> Self
pub fn new_spanless(data: T) -> Self
Creates a new expression without a declared span. WARNING: the expression has no node.
pub fn take_node(&mut self) -> Option<HierarchyNode<T::Node>>
Trait Implementations§
source§impl<T: ?Sized + Displayed> CloneWithNode for Expr<T>
impl<T: ?Sized + Displayed> CloneWithNode for Expr<T>
fn clone_with_node(&mut self) -> Self
fn clone_without_node(&self) -> Self
source§impl ConvertFrom<Expr<Bundle>> for Bundle
impl ConvertFrom<Expr<Bundle>> for Bundle
source§fn convert_from(value: Expr<Bundle>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Bundle>> for Circle
impl ConvertFrom<Expr<Bundle>> for Circle
source§fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Bundle>> for Line
impl ConvertFrom<Expr<Bundle>> for Line
source§fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Bundle>> for Point
impl ConvertFrom<Expr<Bundle>> for Point
source§fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Bundle>> for PointCollection
impl ConvertFrom<Expr<Bundle>> for PointCollection
source§fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Bundle>> for Scalar
impl ConvertFrom<Expr<Bundle>> for Scalar
source§fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Bundle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Bundle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for Bundle
impl ConvertFrom<Expr<Circle>> for Bundle
source§fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for Circle
impl ConvertFrom<Expr<Circle>> for Circle
source§fn convert_from(value: Expr<Circle>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for Line
impl ConvertFrom<Expr<Circle>> for Line
source§fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for Point
impl ConvertFrom<Expr<Circle>> for Point
source§fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for PointCollection
impl ConvertFrom<Expr<Circle>> for PointCollection
source§fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Circle>> for Scalar
impl ConvertFrom<Expr<Circle>> for Scalar
source§fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Circle>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Circle>) -> bool
source§impl ConvertFrom<Expr<Line>> for Bundle
impl ConvertFrom<Expr<Line>> for Bundle
source§fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Line>> for Circle
impl ConvertFrom<Expr<Line>> for Circle
source§fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Line>> for Line
impl ConvertFrom<Expr<Line>> for Line
source§fn convert_from(value: Expr<Line>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Line>> for Point
impl ConvertFrom<Expr<Line>> for Point
source§fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Line>> for PointCollection
impl ConvertFrom<Expr<Line>> for PointCollection
source§fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Line>> for Scalar
impl ConvertFrom<Expr<Line>> for Scalar
source§fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Line>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Line>) -> bool
source§impl ConvertFrom<Expr<Point>> for Bundle
impl ConvertFrom<Expr<Point>> for Bundle
source§fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<Point>> for Circle
impl ConvertFrom<Expr<Point>> for Circle
source§fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<Point>> for Line
impl ConvertFrom<Expr<Point>> for Line
source§fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<Point>> for Point
impl ConvertFrom<Expr<Point>> for Point
source§fn convert_from(value: Expr<Point>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<Point>> for PointCollection
impl ConvertFrom<Expr<Point>> for PointCollection
source§fn convert_from(value: Expr<Point>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<Point>> for Scalar
impl ConvertFrom<Expr<Point>> for Scalar
source§fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Point>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Point>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for Bundle
impl ConvertFrom<Expr<PointCollection>> for Bundle
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for Circle
impl ConvertFrom<Expr<PointCollection>> for Circle
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for Line
impl ConvertFrom<Expr<PointCollection>> for Line
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for Point
impl ConvertFrom<Expr<PointCollection>> for Point
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for PointCollection
impl ConvertFrom<Expr<PointCollection>> for PointCollection
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<PointCollection>> for Scalar
impl ConvertFrom<Expr<PointCollection>> for Scalar
source§fn convert_from(
value: Expr<PointCollection>,
context: &CompileContext,
) -> Expr<Self>
fn convert_from( value: Expr<PointCollection>, context: &CompileContext, ) -> Expr<Self>
Errors Read more
fn can_convert_from(value: &Expr<PointCollection>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for Bundle
impl ConvertFrom<Expr<Scalar>> for Bundle
source§fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for Circle
impl ConvertFrom<Expr<Scalar>> for Circle
source§fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for Line
impl ConvertFrom<Expr<Scalar>> for Line
source§fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for Point
impl ConvertFrom<Expr<Scalar>> for Point
source§fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for PointCollection
impl ConvertFrom<Expr<Scalar>> for PointCollection
source§fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Scalar>> for Scalar
impl ConvertFrom<Expr<Scalar>> for Scalar
source§fn convert_from(value: Expr<Scalar>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Scalar>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Scalar>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for Bundle
impl ConvertFrom<Expr<Unknown>> for Bundle
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for Circle
impl ConvertFrom<Expr<Unknown>> for Circle
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for Line
impl ConvertFrom<Expr<Unknown>> for Line
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for Point
impl ConvertFrom<Expr<Unknown>> for Point
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for PointCollection
impl ConvertFrom<Expr<Unknown>> for PointCollection
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl ConvertFrom<Expr<Unknown>> for Scalar
impl ConvertFrom<Expr<Unknown>> for Scalar
source§fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
fn convert_from(value: Expr<Unknown>, _context: &CompileContext) -> Expr<Self>
Errors Read more
fn can_convert_from(_value: &Expr<Unknown>) -> bool
source§impl From<Expr<PointCollection>> for AnyExpr
impl From<Expr<PointCollection>> for AnyExpr
source§fn from(value: Expr<PointCollection>) -> Self
fn from(value: Expr<PointCollection>) -> Self
Converts to this type from the input type.
source§impl<T: GetValueType + Displayed> GetValueType for Expr<T>
impl<T: GetValueType + Displayed> GetValueType for Expr<T>
fn get_value_type(&self) -> Type
Auto Trait Implementations§
impl<T> Freeze for Expr<T>
impl<T> !RefUnwindSafe for Expr<T>
impl<T> !Send for Expr<T>
impl<T> !Sync for Expr<T>
impl<T> Unpin for Expr<T>
impl<T> !UnwindSafe for Expr<T>
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