pub enum KclValue {
Show 24 variants
Uuid {
value: Uuid,
meta: Vec<Metadata>,
},
Bool {
value: bool,
meta: Vec<Metadata>,
},
Number {
value: f64,
ty: NumericType,
meta: Vec<Metadata>,
},
String {
value: String,
meta: Vec<Metadata>,
},
SketchVar {
value: Box<SketchVar>,
},
SketchConstraint {
value: Box<SketchConstraint>,
},
Tuple {
value: Vec<KclValue>,
meta: Vec<Metadata>,
},
HomArray {
value: Vec<KclValue>,
ty: RuntimeType,
},
Object {
value: HashMap<String, KclValue>,
constrainable: bool,
object_kind: KclObjectKind,
meta: Vec<Metadata>,
},
TagIdentifier(Box<TagIdentifier>),
TagDeclarator(Box<Node<TagDeclarator>>),
GdtAnnotation {
value: Box<GdtAnnotation>,
},
Plane {
value: Box<Plane>,
},
Face {
value: Box<Face>,
},
BoundedEdge {
value: BoundedEdge,
meta: Vec<Metadata>,
},
Segment {
value: Box<AbstractSegment>,
},
Sketch {
value: Box<Sketch>,
},
Solid {
value: Box<Solid>,
},
Helix {
value: Box<Helix>,
},
ImportedGeometry(ImportedGeometry),
Function {
value: Box<FunctionSource>,
meta: Vec<Metadata>,
},
Module {
value: ModuleId,
meta: Vec<Metadata>,
},
Type {
value: TypeDef,
experimental: bool,
meta: Vec<Metadata>,
},
KclNone {
value: KclNone,
meta: Vec<Metadata>,
},
}Expand description
Any KCL value.
Variants§
Uuid
Bool
Number
String
SketchVar
SketchConstraint
Tuple
HomArray
Object
Fields
§
object_kind: KclObjectKindTagIdentifier(Box<TagIdentifier>)
TagDeclarator(Box<Node<TagDeclarator>>)
GdtAnnotation
Plane
Face
BoundedEdge
Segment
Sketch
Solid
Helix
ImportedGeometry(ImportedGeometry)
Function
Module
Type
KclNone
Implementations§
Source§impl KclValue
impl KclValue
pub const fn from_number_with_type( f: f64, ty: NumericType, meta: Vec<Metadata>, ) -> Self
Sourcepub fn from_point2d(p: [f64; 2], ty: NumericType, meta: Vec<Metadata>) -> Self
pub fn from_point2d(p: [f64; 2], ty: NumericType, meta: Vec<Metadata>) -> Self
Put the point into a KCL value.
Sourcepub fn from_point3d(p: [f64; 3], ty: NumericType, meta: Vec<Metadata>) -> Self
pub fn from_point3d(p: [f64; 3], ty: NumericType, meta: Vec<Metadata>) -> Self
Put the point into a KCL value.
Sourcepub fn array_from_point3d(
p: [f64; 3],
ty: NumericType,
meta: Vec<Metadata>,
) -> Self
pub fn array_from_point3d( p: [f64; 3], ty: NumericType, meta: Vec<Metadata>, ) -> Self
Put the point into a KCL point.
pub fn as_int(&self) -> Option<i64>
pub fn as_int_with_ty(&self) -> Option<(i64, NumericType)>
pub fn as_object(&self) -> Option<&HashMap<String, KclValue>>
pub fn into_object(self) -> Option<HashMap<String, KclValue>>
pub fn as_unsolved_expr(&self) -> Option<UnsolvedExpr>
pub fn to_sketch_expr(&self) -> Option<Expr>
pub fn as_str(&self) -> Option<&str>
pub fn into_array(self) -> Vec<KclValue>
pub fn as_slice(&self) -> Option<&[KclValue]>
pub fn as_point2d(&self) -> Option<[TyF64; 2]>
pub fn as_point3d(&self) -> Option<[TyF64; 3]>
pub fn as_uuid(&self) -> Option<Uuid>
pub fn as_plane(&self) -> Option<&Plane>
pub fn as_solid(&self) -> Option<&Solid>
pub fn as_sketch(&self) -> Option<&Sketch>
pub fn as_mut_sketch(&mut self) -> Option<&mut Sketch>
pub fn as_sketch_var(&self) -> Option<&SketchVar>
Sourcepub fn as_segment(&self) -> Option<&Segment>
pub fn as_segment(&self) -> Option<&Segment>
A solved segment.
Sourcepub fn into_segment(self) -> Option<Segment>
pub fn into_segment(self) -> Option<Segment>
A solved segment.
pub fn as_mut_tag(&mut self) -> Option<&mut TagIdentifier>
pub fn as_ty_f64(&self) -> Option<TyF64>
pub fn as_bool(&self) -> Option<bool>
Sourcepub fn as_function(&self) -> Option<&FunctionSource>
pub fn as_function(&self) -> Option<&FunctionSource>
If this value is of type function, return it.
Sourcepub fn get_tag_identifier(&self) -> Result<TagIdentifier, KclError>
pub fn get_tag_identifier(&self) -> Result<TagIdentifier, KclError>
Get a tag identifier from a memory item.
Sourcepub fn get_tag_declarator(&self) -> Result<Node<TagDeclarator>, KclError>
pub fn get_tag_declarator(&self) -> Result<Node<TagDeclarator>, KclError>
Get a tag declarator from a memory item.
pub fn is_unknown_number(&self) -> bool
pub fn value_str(&self) -> Option<String>
Source§impl KclValue
impl KclValue
Sourcepub fn has_type(&self, ty: &RuntimeType) -> bool
pub fn has_type(&self, ty: &RuntimeType) -> bool
True if self has a type which is a subtype of ty without coercion.
Sourcepub fn coerce(
&self,
ty: &RuntimeType,
convert_units: bool,
exec_state: &mut ExecState,
) -> Result<KclValue, CoercionError>
pub fn coerce( &self, ty: &RuntimeType, convert_units: bool, exec_state: &mut ExecState, ) -> Result<KclValue, CoercionError>
Coerce self to a new value which has ty as its closest supertype.
If the result is Ok, then:
- result.principal_type().unwrap().subtype(ty)
If self.principal_type() == ty then result == self
pub fn principal_type(&self) -> Option<RuntimeType>
pub fn principal_type_string(&self) -> String
Trait Implementations§
Source§impl From<&KclValue> for SourceRange
impl From<&KclValue> for SourceRange
Source§impl From<KclValue> for KclValueView
impl From<KclValue> for KclValueView
Source§impl<'a> FromKclValue<'a> for KclValue
impl<'a> FromKclValue<'a> for KclValue
Source§fn from_kcl_val(arg: &'a KclValue) -> Option<Self>
fn from_kcl_val(arg: &'a KclValue) -> Option<Self>
Try to convert a KclValue into this type.
impl StructuralPartialEq for KclValue
Auto Trait Implementations§
impl Freeze for KclValue
impl RefUnwindSafe for KclValue
impl Send for KclValue
impl Sync for KclValue
impl Unpin for KclValue
impl UnsafeUnpin for KclValue
impl UnwindSafe for KclValue
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.