added #[inline] to more window accessor functions (#830)

This commit is contained in:
Mikail Khan 2020-11-10 20:20:31 -05:00 committed by GitHub
parent c9acef04e3
commit b3e1048e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,6 +137,7 @@ impl Window {
self.height = height; self.height = height;
} }
#[inline]
pub fn title(&self) -> &str { pub fn title(&self) -> &str {
&self.title &self.title
} }
@ -146,15 +147,18 @@ impl Window {
self.command_queue.push(WindowCommand::SetTitle { title }); self.command_queue.push(WindowCommand::SetTitle { title });
} }
#[inline]
pub fn vsync(&self) -> bool { pub fn vsync(&self) -> bool {
self.vsync self.vsync
} }
#[inline]
pub fn set_vsync(&mut self, vsync: bool) { pub fn set_vsync(&mut self, vsync: bool) {
self.vsync = vsync; self.vsync = vsync;
self.command_queue.push(WindowCommand::SetVsync { vsync }); self.command_queue.push(WindowCommand::SetVsync { vsync });
} }
#[inline]
pub fn resizable(&self) -> bool { pub fn resizable(&self) -> bool {
self.resizable self.resizable
} }
@ -165,6 +169,7 @@ impl Window {
.push(WindowCommand::SetResizable { resizable }); .push(WindowCommand::SetResizable { resizable });
} }
#[inline]
pub fn decorations(&self) -> bool { pub fn decorations(&self) -> bool {
self.decorations self.decorations
} }
@ -175,6 +180,7 @@ impl Window {
.push(WindowCommand::SetDecorations { decorations }); .push(WindowCommand::SetDecorations { decorations });
} }
#[inline]
pub fn cursor_locked(&self) -> bool { pub fn cursor_locked(&self) -> bool {
self.cursor_locked self.cursor_locked
} }
@ -185,6 +191,7 @@ impl Window {
.push(WindowCommand::SetCursorLockMode { locked: lock_mode }); .push(WindowCommand::SetCursorLockMode { locked: lock_mode });
} }
#[inline]
pub fn cursor_visible(&self) -> bool { pub fn cursor_visible(&self) -> bool {
self.cursor_visible self.cursor_visible
} }
@ -196,6 +203,7 @@ impl Window {
}); });
} }
#[inline]
pub fn mode(&self) -> WindowMode { pub fn mode(&self) -> WindowMode {
self.mode self.mode
} }
@ -208,6 +216,7 @@ impl Window {
}); });
} }
#[inline]
pub fn drain_commands(&mut self) -> impl Iterator<Item = WindowCommand> + '_ { pub fn drain_commands(&mut self) -> impl Iterator<Item = WindowCommand> + '_ {
self.command_queue.drain(..) self.command_queue.drain(..)
} }