Add #[inline] attributes
This commit is contained in:
parent
3820d307a3
commit
aa9cb99929
23 changed files with 384 additions and 3 deletions
|
|
@ -59,6 +59,7 @@ pub enum WindowProxy {
|
|||
}
|
||||
|
||||
impl WindowProxy {
|
||||
#[inline]
|
||||
pub fn wakeup_event_loop(&self) {
|
||||
match self {
|
||||
&WindowProxy::X(ref wp) => wp.wakeup_event_loop(),
|
||||
|
|
@ -77,6 +78,7 @@ pub enum MonitorID {
|
|||
None,
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_available_monitors() -> VecDeque<MonitorID> {
|
||||
match *BACKEND {
|
||||
Backend::Wayland => wayland::get_available_monitors()
|
||||
|
|
@ -91,6 +93,7 @@ pub fn get_available_monitors() -> VecDeque<MonitorID> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_primary_monitor() -> MonitorID {
|
||||
match *BACKEND {
|
||||
Backend::Wayland => MonitorID::Wayland(wayland::get_primary_monitor()),
|
||||
|
|
@ -100,6 +103,7 @@ pub fn get_primary_monitor() -> MonitorID {
|
|||
}
|
||||
|
||||
impl MonitorID {
|
||||
#[inline]
|
||||
pub fn get_name(&self) -> Option<String> {
|
||||
match self {
|
||||
&MonitorID::X(ref m) => m.get_name(),
|
||||
|
|
@ -108,6 +112,7 @@ impl MonitorID {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_native_identifier(&self) -> ::native_monitor::NativeMonitorId {
|
||||
match self {
|
||||
&MonitorID::X(ref m) => m.get_native_identifier(),
|
||||
|
|
@ -116,6 +121,7 @@ impl MonitorID {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_dimensions(&self) -> (u32, u32) {
|
||||
match self {
|
||||
&MonitorID::X(ref m) => m.get_dimensions(),
|
||||
|
|
@ -136,6 +142,7 @@ pub enum PollEventsIterator<'a> {
|
|||
impl<'a> Iterator for PollEventsIterator<'a> {
|
||||
type Item = Event;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Event> {
|
||||
match self {
|
||||
&mut PollEventsIterator::X(ref mut it) => it.next(),
|
||||
|
|
@ -154,6 +161,7 @@ pub enum WaitEventsIterator<'a> {
|
|||
impl<'a> Iterator for WaitEventsIterator<'a> {
|
||||
type Item = Event;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<Event> {
|
||||
match self {
|
||||
&mut WaitEventsIterator::X(ref mut it) => it.next(),
|
||||
|
|
@ -163,6 +171,7 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
#[inline]
|
||||
pub fn new(window: &WindowAttributes, pf_reqs: &PixelFormatRequirements,
|
||||
opengl: &GlAttributes<&Window>) -> Result<Window, CreationError>
|
||||
{
|
||||
|
|
@ -189,6 +198,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_title(&self, title: &str) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_title(title),
|
||||
|
|
@ -196,6 +206,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn show(&self) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.show(),
|
||||
|
|
@ -203,6 +214,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn hide(&self) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.hide(),
|
||||
|
|
@ -210,6 +222,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_position(&self) -> Option<(i32, i32)> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_position(),
|
||||
|
|
@ -217,6 +230,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_position(&self, x: i32, y: i32) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_position(x, y),
|
||||
|
|
@ -224,6 +238,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_inner_size(),
|
||||
|
|
@ -231,6 +246,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_outer_size(),
|
||||
|
|
@ -238,6 +254,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_inner_size(&self, x: u32, y: u32) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_inner_size(x, y),
|
||||
|
|
@ -245,6 +262,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn create_window_proxy(&self) -> WindowProxy {
|
||||
match self {
|
||||
&Window::X(ref w) => WindowProxy::X(w.create_window_proxy()),
|
||||
|
|
@ -252,6 +270,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn poll_events(&self) -> PollEventsIterator {
|
||||
match self {
|
||||
&Window::X(ref w) => PollEventsIterator::X(w.poll_events()),
|
||||
|
|
@ -259,6 +278,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn wait_events(&self) -> WaitEventsIterator {
|
||||
match self {
|
||||
&Window::X(ref w) => WaitEventsIterator::X(w.wait_events()),
|
||||
|
|
@ -266,6 +286,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_window_resize_callback(&mut self, callback: Option<fn(u32, u32)>) {
|
||||
match self {
|
||||
&mut Window::X(ref mut w) => w.set_window_resize_callback(callback),
|
||||
|
|
@ -273,6 +294,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_cursor(&self, cursor: MouseCursor) {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_cursor(cursor),
|
||||
|
|
@ -280,6 +302,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_cursor_state(state),
|
||||
|
|
@ -287,6 +310,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn hidpi_factor(&self) -> f32 {
|
||||
match self {
|
||||
&Window::X(ref w) => w.hidpi_factor(),
|
||||
|
|
@ -294,6 +318,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.set_cursor_position(x, y),
|
||||
|
|
@ -301,6 +326,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||
match self {
|
||||
&Window::X(ref w) => w.platform_display(),
|
||||
|
|
@ -308,6 +334,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn platform_window(&self) -> *mut libc::c_void {
|
||||
match self {
|
||||
&Window::X(ref w) => w.platform_window(),
|
||||
|
|
@ -317,6 +344,7 @@ impl Window {
|
|||
}
|
||||
|
||||
impl GlContext for Window {
|
||||
#[inline]
|
||||
unsafe fn make_current(&self) -> Result<(), ContextError> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.make_current(),
|
||||
|
|
@ -324,6 +352,7 @@ impl GlContext for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_current(&self) -> bool {
|
||||
match self {
|
||||
&Window::X(ref w) => w.is_current(),
|
||||
|
|
@ -331,6 +360,7 @@ impl GlContext for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_proc_address(addr),
|
||||
|
|
@ -338,6 +368,7 @@ impl GlContext for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn swap_buffers(&self) -> Result<(), ContextError> {
|
||||
match self {
|
||||
&Window::X(ref w) => w.swap_buffers(),
|
||||
|
|
@ -345,6 +376,7 @@ impl GlContext for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_api(&self) -> ::Api {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_api(),
|
||||
|
|
@ -352,6 +384,7 @@ impl GlContext for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_pixel_format(&self) -> PixelFormat {
|
||||
match self {
|
||||
&Window::X(ref w) => w.get_pixel_format(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue