pub struct Snippet { /* private fields */ }
Implementations
sourceimpl Snippet
impl Snippet
sourcepub fn new(hook: SnippetHook, declarations: &str, post: &str) -> Snippet
pub fn new(hook: SnippetHook, declarations: &str, post: &str) -> Snippet
Allocates and initializes a new snippet with the given source strings.
hook
The point in the pipeline that this snippet will wrap around or replace.
declarations
The source code for the declarations for this
snippet or None
. See Snippet::set_declarations
.
post
The source code to run after the hook point where this
shader snippet is attached or None
. See Snippet::set_post
.
Returns
a pointer to a new Snippet
sourcepub fn declarations(&self) -> Option<String>
pub fn declarations(&self) -> Option<String>
Returns
the source string that was set with
Snippet::set_declarations
or None
if none was set.
sourcepub fn hook(&self) -> SnippetHook
pub fn hook(&self) -> SnippetHook
Returns
the hook that was set when Snippet::new
was
called.
sourcepub fn post(&self) -> Option<String>
pub fn post(&self) -> Option<String>
Returns
the source string that was set with
Snippet::set_post
or None
if none was set.
sourcepub fn pre(&self) -> Option<String>
pub fn pre(&self) -> Option<String>
Returns
the source string that was set with
Snippet::set_pre
or None
if none was set.
sourcepub fn replace(&self) -> Option<String>
pub fn replace(&self) -> Option<String>
Returns
the source string that was set with
Snippet::set_replace
or None
if none was set.
sourcepub fn set_declarations(&self, declarations: &str)
pub fn set_declarations(&self, declarations: &str)
Sets a source string that will be inserted in the global scope of the generated shader when this snippet is used on a pipeline. This string is typically used to declare uniforms, attributes or functions that will be used by the other parts of the snippets.
This fn should only be called before the snippet is attached to its first pipeline. After that the snippet should be considered immutable.
declarations
The new source string for the declarations section of this snippet.
sourcepub fn set_post(&self, post: &str)
pub fn set_post(&self, post: &str)
Sets a source string that will be inserted after the hook point in
the generated shader for the pipeline that this snippet is attached
to. Please see the documentation of each hook point in
Pipeline
for a description of how this string should be used.
This fn should only be called before the snippet is attached to its first pipeline. After that the snippet should be considered immutable.
post
The new source string for the post section of this snippet.
sourcepub fn set_pre(&self, pre: &str)
pub fn set_pre(&self, pre: &str)
Sets a source string that will be inserted before the hook point in
the generated shader for the pipeline that this snippet is attached
to. Please see the documentation of each hook point in
Pipeline
for a description of how this string should be used.
This fn should only be called before the snippet is attached to its first pipeline. After that the snippet should be considered immutable.
pre
The new source string for the pre section of this snippet.
sourcepub fn set_replace(&self, replace: &str)
pub fn set_replace(&self, replace: &str)
Sets a source string that will be used instead of any generated
source code or any previous snippets for this hook point. Please
see the documentation of each hook point in Pipeline
for a
description of how this string should be used.
This fn should only be called before the snippet is attached to its first pipeline. After that the snippet should be considered immutable.
replace
The new source string for the replace section of this snippet.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Snippet
impl Send for Snippet
impl Sync for Snippet
impl Unpin for Snippet
impl UnwindSafe for Snippet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.