pub struct GLSLFunction {
pub name: String,
pub return_type: GLSLType,
pub params: Vec<GLSLVariable>,
pub body: Vec<String>,
}Expand description
A GLSL function definition.
Fields§
§name: StringFunction name.
return_type: GLSLTypeReturn type.
params: Vec<GLSLVariable>Ordered list of parameters.
body: Vec<String>Body statements (each is emitted on its own line with indentation).
Implementations§
Source§impl GLSLFunction
impl GLSLFunction
Sourcepub fn new(name: impl Into<String>, return_type: GLSLType) -> Self
pub fn new(name: impl Into<String>, return_type: GLSLType) -> Self
Create a new function with an empty body.
Sourcepub fn add_param(&mut self, var: GLSLVariable)
pub fn add_param(&mut self, var: GLSLVariable)
Add a parameter.
Sourcepub fn add_statement(&mut self, stmt: impl Into<String>)
pub fn add_statement(&mut self, stmt: impl Into<String>)
Append a statement to the body.
Sourcepub fn emit_prototype(&self) -> String
pub fn emit_prototype(&self) -> String
Emit the forward declaration (prototype).
Trait Implementations§
Source§impl Clone for GLSLFunction
impl Clone for GLSLFunction
Source§fn clone(&self) -> GLSLFunction
fn clone(&self) -> GLSLFunction
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 GLSLFunction
impl RefUnwindSafe for GLSLFunction
impl Send for GLSLFunction
impl Sync for GLSLFunction
impl Unpin for GLSLFunction
impl UnsafeUnpin for GLSLFunction
impl UnwindSafe for GLSLFunction
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