Skip to content

Commit

Permalink
Add some more #[inline]
Browse files Browse the repository at this point in the history
  • Loading branch information
Boddlnagg committed Aug 3, 2019
1 parent 1733e10 commit 079a326
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
13 changes: 7 additions & 6 deletions src/cominterfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ pub struct IUnknown(ComPtr<w::um::unknwnbase::IUnknown>);
impl ComIid for IUnknown { #[inline] fn iid() -> &'static Guid { &IID_IUnknown } }
impl ComInterfaceAbi for w::um::unknwnbase::IUnknown {
type Vtbl = w::um::unknwnbase::IUnknownVtbl;
#[inline]
fn get_vtbl(&self) -> *const Self::Vtbl {
self.lpVtbl
}
}
impl ComInterface for IUnknown {
type TAbi = w::um::unknwnbase::IUnknown;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IUnknown(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IUnknown(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}

impl IUnknown {
Expand All @@ -80,8 +81,8 @@ pub struct IRestrictedErrorInfo(ComPtr<ComAbi<w::um::restrictederrorinfo::IRestr
impl ComIid for IRestrictedErrorInfo { #[inline] fn iid() -> &'static Guid { &IID_IRestrictedErrorInfo } }
impl ComInterface for IRestrictedErrorInfo {
type TAbi = ComAbi<w::um::restrictederrorinfo::IRestrictedErrorInfoVtbl>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IRestrictedErrorInfo(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IRestrictedErrorInfo(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}

DEFINE_IID!(IID_IAgileObject, 0x94EA2B94, 0xE9CC, 0x49E0, 0xC0, 0xFF, 0xEE, 0x64, 0xCA, 0x8F, 0x5B, 0x90);
Expand All @@ -106,6 +107,6 @@ impl std::ops::DerefMut for IAgileObject {
impl ComIid for IAgileObject { #[inline] fn iid() -> &'static Guid { &IID_IAgileObject } }
impl ComInterface for IAgileObject {
type TAbi = ComAbi<w::um::unknwnbase::IUnknownVtbl>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IAgileObject(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IAgileObject(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
1 change: 1 addition & 0 deletions src/comptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct ComAbi<Vtbl> {

impl<Vtbl> ComInterfaceAbi for ComAbi<Vtbl> {
type Vtbl = Vtbl;
#[inline]
fn get_vtbl(&self) -> *const Vtbl {
self.lpVtbl
}
Expand Down
20 changes: 10 additions & 10 deletions src/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ macro_rules! RT_INTERFACE {
}
impl ComInterface for $interface {
type TAbi = crate::comptr::ComAbi<$vtbl>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
impl crate::RtType for $interface {
type In = Self;
Expand Down Expand Up @@ -362,8 +362,8 @@ macro_rules! RT_INTERFACE {
}
impl ComInterface for $interface {
type TAbi = crate::comptr::ComAbi<$vtbl>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
impl crate::RtType for $interface {
type In = Self;
Expand Down Expand Up @@ -408,8 +408,8 @@ macro_rules! RT_INTERFACE {
pub struct $interface<$t1: RtType>(ComPtr<crate::comptr::ComAbi<$vtbl<$t1>>>);
impl<$t1> ComInterface for $interface<$t1> where $t1: RtType {
type TAbi = crate::comptr::ComAbi<$vtbl<$t1>>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
impl<$t1> crate::RtType for $interface<$t1> where $t1: RtType{
type In = Self;
Expand Down Expand Up @@ -453,8 +453,8 @@ macro_rules! RT_INTERFACE {
pub struct $interface<$t1: RtType, $t2: RtType>(ComPtr<crate::comptr::ComAbi<$vtbl<$t1, $t2>>>);
impl<$t1, $t2> ComInterface for $interface<$t1, $t2> where $t1: RtType, $t2: RtType {
type TAbi = crate::comptr::ComAbi<$vtbl<$t1, $t2>>;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
impl<$t1, $t2> crate::RtType for $interface<$t1, $t2> where $t1: RtType, $t2: RtType {
type In = Self;
Expand Down Expand Up @@ -634,8 +634,8 @@ macro_rules! RT_CLASS {
unsafe impl crate::RtClassInterface for $cls {}
impl ComInterface for $cls {
type TAbi = <$interface as ComInterface>::TAbi;
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $cls(ComPtr::wrap(ptr)) }
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $cls(ComPtr::wrap(ptr)) }
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
}
impl ComIid for $cls {
#[inline] fn iid() -> &'static crate::Guid { <$interface as ComIid>::iid() }
Expand Down

0 comments on commit 079a326

Please sign in to comment.