Skip to content

Commit

Permalink
gsk: manually implement get_child functions
Browse files Browse the repository at this point in the history
And add an assertion that idx < n_children
  • Loading branch information
bilelmoussaoui committed Dec 30, 2021
1 parent 54270a4 commit 25cdcca
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
6 changes: 6 additions & 0 deletions gsk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ status = "generate"
[[object.function]]
name = "new"
manual = true
[[object.function]]
name = "get_child"
manual = true # assert that idx < n_children

[[object]]
name = "Gsk.GLShader"
Expand Down Expand Up @@ -138,6 +141,9 @@ status = "generate"
[[object.function]]
name = "new"
manual = true
[[object.function]]
name = "get_child"
manual = true # assert that idx < n_children

[[object]]
name = "Gsk.LinearGradientNode"
Expand Down
11 changes: 0 additions & 11 deletions gsk4/src/auto/container_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ glib::wrapper! {
}

impl ContainerNode {
#[doc(alias = "gsk_container_node_get_child")]
#[doc(alias = "get_child")]
pub fn child(&self, idx: u32) -> Option<RenderNode> {
unsafe {
from_glib_none(ffi::gsk_container_node_get_child(
self.to_glib_none().0,
idx,
))
}
}

#[doc(alias = "gsk_container_node_get_n_children")]
#[doc(alias = "get_n_children")]
pub fn n_children(&self) -> u32 {
Expand Down
11 changes: 0 additions & 11 deletions gsk4/src/auto/gl_shader_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ impl GLShaderNode {
unsafe { from_glib_none(ffi::gsk_gl_shader_node_get_args(self.to_glib_none().0)) }
}

#[doc(alias = "gsk_gl_shader_node_get_child")]
#[doc(alias = "get_child")]
pub fn child(&self, idx: u32) -> Option<RenderNode> {
unsafe {
from_glib_none(ffi::gsk_gl_shader_node_get_child(
self.to_glib_none().0,
idx,
))
}
}

#[doc(alias = "gsk_gl_shader_node_get_n_children")]
#[doc(alias = "get_n_children")]
pub fn n_children(&self) -> u32 {
Expand Down
12 changes: 12 additions & 0 deletions gsk4/src/container_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ impl ContainerNode {
))
}
}

#[doc(alias = "gsk_container_node_get_child")]
#[doc(alias = "get_child")]
pub fn child(&self, idx: u32) -> Option<RenderNode> {
assert!(idx < self.n_children());
unsafe {
from_glib_none(ffi::gsk_container_node_get_child(
self.to_glib_none().0,
idx,
))
}
}
}
12 changes: 12 additions & 0 deletions gsk4/src/gl_shader_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,16 @@ impl GLShaderNode {
))
}
}

#[doc(alias = "gsk_gl_shader_node_get_child")]
#[doc(alias = "get_child")]
pub fn child(&self, idx: u32) -> Option<RenderNode> {
assert!(idx < self.n_children());
unsafe {
from_glib_none(ffi::gsk_gl_shader_node_get_child(
self.to_glib_none().0,
idx,
))
}
}
}

0 comments on commit 25cdcca

Please sign in to comment.