pub struct Constant {
pub name: Option<String>,
pub ty: Type,
pub value: ConstantValue,
pub spec_id: Option<u32>,
}
Expand description
Constant or specialization constant record.
Fields§
§name: Option<String>
§ty: Type
Type of constant.
value: ConstantValue
Defined value of constant, or default value of specialization constant.
spec_id: Option<u32>
Specialization constant ID, notice that this is NOT an instruction ID. It is used to identify specialization constants for graphics libraries.
Implementations§
source§impl Constant
impl Constant
sourcepub fn new(name: Option<String>, ty: Type, value: ConstantValue) -> Constant
pub fn new(name: Option<String>, ty: Type, value: ConstantValue) -> Constant
Create a constant record with name, type and value. ty
must be a
ScalarType
.
sourcepub fn new_itm(ty: Type, value: ConstantValue) -> Constant
pub fn new_itm(ty: Type, value: ConstantValue) -> Constant
Create an intermediate constant record with type and value. Intermediate constants don’t have names because they contribute to subexpressions in arithmetic.
Trait Implementations§
source§impl PartialEq for Constant
impl PartialEq for Constant
impl Eq for Constant
impl StructuralPartialEq for Constant
Auto Trait Implementations§
impl Freeze for Constant
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
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