Skip to content

Commit 4efae67

Browse files
elmarcobilelmoussaoui
authored andcommitted
gdk: improve GLTextureBuilder build
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent fd94b6c commit 4efae67

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

gdk4/src/gl_texture_builder.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use glib::{prelude::*, translate::*};
55

66
impl GLTextureBuilder {
77
#[doc(alias = "gdk_gl_texture_builder_build")]
8-
pub unsafe fn build(&self) -> Texture {
8+
#[must_use = "The builder must be built to be used"]
9+
pub unsafe fn build(self) -> Texture {
910
from_glib_full(ffi::gdk_gl_texture_builder_build(
1011
self.to_glib_none().0,
1112
None,
@@ -14,10 +15,8 @@ impl GLTextureBuilder {
1415
}
1516

1617
#[doc(alias = "gdk_gl_texture_builder_build")]
17-
pub unsafe fn build_with_release_func<F: FnOnce() + 'static>(
18-
&self,
19-
release_func: F,
20-
) -> Texture {
18+
#[must_use = "The builder must be built to be used"]
19+
pub unsafe fn build_with_release_func<F: FnOnce() + 'static>(self, release_func: F) -> Texture {
2120
unsafe extern "C" fn destroy_closure<F: FnOnce() + 'static>(func: glib::ffi::gpointer) {
2221
let released_func = Box::<F>::from_raw(func as *mut _);
2322
released_func();

0 commit comments

Comments
 (0)