From 2bde1da5c31284e2c92bce36fb0f860040d2091c Mon Sep 17 00:00:00 2001 From: BO41 Date: Fri, 24 May 2019 14:30:32 +0200 Subject: [PATCH] Add documentation to set_icon --- src/sdl2/video.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sdl2/video.rs b/src/sdl2/video.rs index 645878f3..7179187c 100644 --- a/src/sdl2/video.rs +++ b/src/sdl2/video.rs @@ -1225,6 +1225,16 @@ impl Window { } } + /// Use this function to set the icon for a window. + /// + /// # Example: + /// ```compile_fail + /// // requires "--features 'image'" + /// use sdl2::surface::Surface; + /// + /// let window_icon = Surface::from_file("/path/to/icon.png")?; + /// window.set_icon(window_icon); + /// ``` pub fn set_icon>(&mut self, icon: S) { unsafe { sys::SDL_SetWindowIcon(self.context.raw, icon.as_ref().raw())