1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::translate::*;

use crate::{GLShaderNode, RenderNode, RenderNodeType};

define_render_node!(
    GLShaderNode,
    ffi::GskGLShaderNode,
    RenderNodeType::GlShaderNode
);

impl GLShaderNode {
    /// Gets one of the children.
    /// ## `idx`
    /// the position of the child to get
    ///
    /// # Returns
    ///
    /// the @idx'th child of @self
    #[doc(alias = "gsk_gl_shader_node_get_child")]
    #[doc(alias = "get_child")]
    pub fn child(&self, idx: u32) -> RenderNode {
        assert!(idx < self.n_children());
        unsafe {
            from_glib_none(ffi::gsk_gl_shader_node_get_child(
                self.to_glib_none().0,
                idx,
            ))
        }
    }
}

impl std::fmt::Debug for GLShaderNode {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        f.debug_struct("GLShaderNode")
            .field("args", &self.args())
            .field("n_children", &self.n_children())
            .field("shader", &self.shader())
            .finish()
    }
}