Skip to content

Commit 079a326

Browse files
committed
Add some more #[inline]
1 parent 1733e10 commit 079a326

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

src/cominterfaces.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ pub struct IUnknown(ComPtr<w::um::unknwnbase::IUnknown>);
4949
impl ComIid for IUnknown { #[inline] fn iid() -> &'static Guid { &IID_IUnknown } }
5050
impl ComInterfaceAbi for w::um::unknwnbase::IUnknown {
5151
type Vtbl = w::um::unknwnbase::IUnknownVtbl;
52+
#[inline]
5253
fn get_vtbl(&self) -> *const Self::Vtbl {
5354
self.lpVtbl
5455
}
5556
}
5657
impl ComInterface for IUnknown {
5758
type TAbi = w::um::unknwnbase::IUnknown;
58-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IUnknown(ComPtr::wrap(ptr)) }
59-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
59+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IUnknown(ComPtr::wrap(ptr)) }
60+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
6061
}
6162

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

8788
DEFINE_IID!(IID_IAgileObject, 0x94EA2B94, 0xE9CC, 0x49E0, 0xC0, 0xFF, 0xEE, 0x64, 0xCA, 0x8F, 0x5B, 0x90);
@@ -106,6 +107,6 @@ impl std::ops::DerefMut for IAgileObject {
106107
impl ComIid for IAgileObject { #[inline] fn iid() -> &'static Guid { &IID_IAgileObject } }
107108
impl ComInterface for IAgileObject {
108109
type TAbi = ComAbi<w::um::unknwnbase::IUnknownVtbl>;
109-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IAgileObject(ComPtr::wrap(ptr)) }
110-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
110+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { IAgileObject(ComPtr::wrap(ptr)) }
111+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
111112
}

src/comptr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub struct ComAbi<Vtbl> {
1313

1414
impl<Vtbl> ComInterfaceAbi for ComAbi<Vtbl> {
1515
type Vtbl = Vtbl;
16+
#[inline]
1617
fn get_vtbl(&self) -> *const Vtbl {
1718
self.lpVtbl
1819
}

src/rt/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ macro_rules! RT_INTERFACE {
313313
}
314314
impl ComInterface for $interface {
315315
type TAbi = crate::comptr::ComAbi<$vtbl>;
316-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
317-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
316+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
317+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
318318
}
319319
impl crate::RtType for $interface {
320320
type In = Self;
@@ -362,8 +362,8 @@ macro_rules! RT_INTERFACE {
362362
}
363363
impl ComInterface for $interface {
364364
type TAbi = crate::comptr::ComAbi<$vtbl>;
365-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
366-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
365+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
366+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
367367
}
368368
impl crate::RtType for $interface {
369369
type In = Self;
@@ -408,8 +408,8 @@ macro_rules! RT_INTERFACE {
408408
pub struct $interface<$t1: RtType>(ComPtr<crate::comptr::ComAbi<$vtbl<$t1>>>);
409409
impl<$t1> ComInterface for $interface<$t1> where $t1: RtType {
410410
type TAbi = crate::comptr::ComAbi<$vtbl<$t1>>;
411-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
412-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
411+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
412+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
413413
}
414414
impl<$t1> crate::RtType for $interface<$t1> where $t1: RtType{
415415
type In = Self;
@@ -453,8 +453,8 @@ macro_rules! RT_INTERFACE {
453453
pub struct $interface<$t1: RtType, $t2: RtType>(ComPtr<crate::comptr::ComAbi<$vtbl<$t1, $t2>>>);
454454
impl<$t1, $t2> ComInterface for $interface<$t1, $t2> where $t1: RtType, $t2: RtType {
455455
type TAbi = crate::comptr::ComAbi<$vtbl<$t1, $t2>>;
456-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
457-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
456+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $interface(ComPtr::wrap(ptr)) }
457+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
458458
}
459459
impl<$t1, $t2> crate::RtType for $interface<$t1, $t2> where $t1: RtType, $t2: RtType {
460460
type In = Self;
@@ -634,8 +634,8 @@ macro_rules! RT_CLASS {
634634
unsafe impl crate::RtClassInterface for $cls {}
635635
impl ComInterface for $cls {
636636
type TAbi = <$interface as ComInterface>::TAbi;
637-
unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $cls(ComPtr::wrap(ptr)) }
638-
fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
637+
#[inline] unsafe fn wrap_com(ptr: *mut Self::TAbi) -> Self { $cls(ComPtr::wrap(ptr)) }
638+
#[inline] fn get_abi(&self) -> &Self::TAbi { self.0.as_abi() }
639639
}
640640
impl ComIid for $cls {
641641
#[inline] fn iid() -> &'static crate::Guid { <$interface as ComIid>::iid() }

0 commit comments

Comments
 (0)