pub struct GLSLVariable {
pub name: String,
pub ty: GLSLType,
pub qualifier: GLSLQualifier,
pub initializer: Option<String>,
}Expand description
A single GLSL variable (global or function parameter).
Fields§
§name: StringVariable name.
ty: GLSLTypeGLSL type.
qualifier: GLSLQualifierStorage / parameter qualifier.
initializer: Option<String>Optional initialiser expression (e.g. for const variables).
Implementations§
Source§impl GLSLVariable
impl GLSLVariable
Sourcepub fn new(
name: impl Into<String>,
ty: GLSLType,
qualifier: GLSLQualifier,
) -> Self
pub fn new( name: impl Into<String>, ty: GLSLType, qualifier: GLSLQualifier, ) -> Self
Create a new variable with the given name, type, and qualifier.
Sourcepub fn layout_input(
name: impl Into<String>,
ty: GLSLType,
location: u32,
) -> Self
pub fn layout_input( name: impl Into<String>, ty: GLSLType, location: u32, ) -> Self
Create a layout-qualified input variable with the given location index.
Sourcepub fn layout_output(
name: impl Into<String>,
ty: GLSLType,
location: u32,
) -> Self
pub fn layout_output( name: impl Into<String>, ty: GLSLType, location: u32, ) -> Self
Create a layout-qualified output variable with the given location index.
Sourcepub fn emit_global(&self) -> String
pub fn emit_global(&self) -> String
Emit the declaration as a top-level global statement.
Sourcepub fn emit_param(&self) -> String
pub fn emit_param(&self) -> String
Emit the declaration as a function parameter (no semicolon, no initializer).
Trait Implementations§
Source§impl Clone for GLSLVariable
impl Clone for GLSLVariable
Source§fn clone(&self) -> GLSLVariable
fn clone(&self) -> GLSLVariable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GLSLVariable
impl RefUnwindSafe for GLSLVariable
impl Send for GLSLVariable
impl Sync for GLSLVariable
impl Unpin for GLSLVariable
impl UnsafeUnpin for GLSLVariable
impl UnwindSafe for GLSLVariable
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