pub struct Variable {
pub kind: VariableKind,
pub ty: Type,
}Fields§
§kind: VariableKind§ty: TypeImplementations§
Source§impl Variable
impl Variable
pub fn new(kind: VariableKind, item: Type) -> Variable
pub fn builtin(builtin: Builtin, ty: StorageType) -> Variable
pub fn constant(value: ConstantValue, ty: impl Into<Type>) -> Variable
pub fn elem_type(&self) -> ElemType
pub fn storage_type(&self) -> StorageType
Source§impl Variable
impl Variable
Sourcepub fn is_immutable(&self) -> bool
pub fn is_immutable(&self) -> bool
Whether a variable is always immutable. Used for optimizations to determine whether it’s safe to inline/merge
Sourcepub fn is_array(&self) -> bool
pub fn is_array(&self) -> bool
Is this an array type that yields items when indexed, or a scalar/vector that yields elems/slices when indexed?
Sourcepub fn is_memory(&self) -> bool
pub fn is_memory(&self) -> bool
Is this an array type that is contained in concrete memory, or a local array/scalar/vector?
pub fn has_length(&self) -> bool
pub fn has_buffer_length(&self) -> bool
Sourcepub fn is_constant(&self, value: i64) -> bool
pub fn is_constant(&self, value: i64) -> bool
Determines if the value is a constant with the specified value (converted if necessary)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Variable
impl<'de> Deserialize<'de> for Variable
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Variable, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Variable, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const POS: u8> From<ElemExpand<POS>> for Variable
impl<const POS: u8> From<ElemExpand<POS>> for Variable
Source§fn from(val: ElemExpand<POS>) -> Variable
fn from(val: ElemExpand<POS>) -> Variable
Converts to this type from the input type.
Source§impl From<ExpandElement> for Variable
impl From<ExpandElement> for Variable
Source§fn from(value: ExpandElement) -> Variable
fn from(value: ExpandElement) -> Variable
Converts to this type from the input type.
Source§impl<T> From<ExpandElementTyped<T>> for Variablewhere
T: CubeType,
impl<T> From<ExpandElementTyped<T>> for Variablewhere
T: CubeType,
Source§fn from(value: ExpandElementTyped<T>) -> Variable
fn from(value: ExpandElementTyped<T>) -> Variable
Converts to this type from the input type.
Source§impl FromArgList for Variable
impl FromArgList for Variable
Source§fn from_arg_list(args: &mut VecDeque<Variable>) -> Variable
fn from_arg_list(args: &mut VecDeque<Variable>) -> Variable
Creates this type from a list of variables. This works like a parse stream, where consumed
variables are popped from the front.
Source§fn as_arg_list(&self) -> impl IntoIterator<Item = Variable>
fn as_arg_list(&self) -> impl IntoIterator<Item = Variable>
Turns this type into a list of
Variables.Source§impl OperationArgs for Variable
impl OperationArgs for Variable
Source§impl Serialize for Variable
impl Serialize for Variable
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Variable
impl Eq for Variable
impl StructuralPartialEq for Variable
Auto Trait Implementations§
impl Freeze for Variable
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnsafeUnpin for Variable
impl UnwindSafe for Variable
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<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.