Struct cogl::Snippet[][src]

pub struct Snippet(_, _);

Implementations

impl Snippet[src]

pub fn new(hook: SnippetHook, declarations: &str, post: &str) -> Snippet[src]

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

pub fn get_declarations(&self) -> Option<GString>[src]

Returns

the source string that was set with Snippet::set_declarations or None if none was set.

pub fn get_hook(&self) -> SnippetHook[src]

Returns

the hook that was set when Snippet::new was called.

pub fn get_post(&self) -> Option<GString>[src]

Returns

the source string that was set with Snippet::set_post or None if none was set.

pub fn get_pre(&self) -> Option<GString>[src]

Returns

the source string that was set with Snippet::set_pre or None if none was set.

pub fn get_replace(&self) -> Option<GString>[src]

Returns

the source string that was set with Snippet::set_replace or None if none was set.

pub fn set_declarations(&self, declarations: &str)[src]

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 function 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.

pub fn set_post(&self, post: &str)[src]

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 function 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.

pub fn set_pre(&self, pre: &str)[src]

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 function 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.

pub fn set_replace(&self, replace: &str)[src]

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 function 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

impl Clone for Snippet[src]

impl Debug for Snippet[src]

impl Display for Snippet[src]

impl Eq for Snippet[src]

impl Hash for Snippet[src]

impl IsA<Object> for Snippet[src]

impl Ord for Snippet[src]

impl<T: ObjectType> PartialEq<T> for Snippet[src]

impl<T: ObjectType> PartialOrd<T> for Snippet[src]

impl StaticType for Snippet[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> Cast for T where
    T: ObjectType
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: SetValue + Send + ToValue + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.