Skip to content

Commit 3f36703

Browse files
committed
AnyUserData::is_proxy
1 parent 0245d4c commit 3f36703

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/userdata.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,14 @@ impl AnyUserData {
679679
matches!(type_id, Some(type_id) if type_id == TypeId::of::<T>())
680680
}
681681

682+
/// Checks whether the type of this userdata is a [proxy object] for `T`.
683+
///
684+
/// [proxy object]: crate::Lua::create_proxy
685+
#[inline]
686+
pub fn is_proxy<T: 'static>(&self) -> bool {
687+
self.is::<UserDataProxy<T>>()
688+
}
689+
682690
/// Borrow this userdata immutably if it is of type `T`.
683691
///
684692
/// # Errors

0 commit comments

Comments
 (0)