Add documentation to set_icon

This commit is contained in:
BO41
2019-05-25 15:08:43 +02:00
parent 73afe22a08
commit 2bde1da5c3
+10
View File
@@ -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<S: AsRef<SurfaceRef>>(&mut self, icon: S) {
unsafe {
sys::SDL_SetWindowIcon(self.context.raw, icon.as_ref().raw())