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 e64006d commit 012aa6b
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 @@ -24,17 +24,6 @@ impl glib::StaticType for ContainerNode {
}

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 @@ -31,17 +31,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 012aa6b

Please sign in to comment.