File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ pub fn impl_object_subclass(input: &syn::ItemImpl) -> TokenStream {
121
121
type FromObjectType = <Self as #crate_ident:: subclass:: types:: ObjectSubclass >:: Type ;
122
122
#[ inline]
123
123
fn from_object( obj: & Self :: FromObjectType ) -> & Self {
124
- <Self as #crate_ident:: subclass:: types:: ObjectSubclassExt >:: from_instance ( obj)
124
+ <Self as #crate_ident:: subclass:: types:: ObjectSubclassExt >:: from_obj ( obj)
125
125
}
126
126
}
127
127
Original file line number Diff line number Diff line change @@ -127,7 +127,16 @@ pub trait ObjectInterfaceExt: ObjectInterface {
127
127
///
128
128
/// This will panic if `obj` does not implement the interface.
129
129
#[ inline]
130
+ #[ deprecated = "Use from_obj() instead" ]
130
131
fn from_instance < T : IsA < Object > > ( obj : & T ) -> & Self {
132
+ Self :: from_obj ( obj)
133
+ }
134
+
135
+ /// Get interface from an instance.
136
+ ///
137
+ /// This will panic if `obj` does not implement the interface.
138
+ #[ inline]
139
+ fn from_obj < T : IsA < Object > > ( obj : & T ) -> & Self {
131
140
assert ! ( obj. as_ref( ) . type_( ) . is_a( Self :: type_( ) ) ) ;
132
141
133
142
unsafe {
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ impl<T: ObjectSubclass> std::ops::Deref for ObjectImplRef<T> {
55
55
56
56
#[ inline]
57
57
fn deref ( & self ) -> & Self :: Target {
58
- T :: from_instance ( & self . 0 )
58
+ T :: from_obj ( & self . 0 )
59
59
}
60
60
}
61
61
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ pub trait ObjectSubclassIsExt: ObjectSubclassIs {
119
119
impl < T : ObjectSubclassIs < Subclass = S > , S : ObjectSubclass < Type = Self > > ObjectSubclassIsExt for T {
120
120
#[ inline]
121
121
fn imp ( & self ) -> & T :: Subclass {
122
- T :: Subclass :: from_instance ( self )
122
+ T :: Subclass :: from_obj ( self )
123
123
}
124
124
}
125
125
@@ -665,10 +665,12 @@ pub trait ObjectSubclassExt: ObjectSubclass {
665
665
// rustdoc-stripper-ignore-next
666
666
/// Returns the corresponding object instance.
667
667
#[ doc( alias = "get_instance" ) ]
668
+ #[ deprecated = "Use obj() instead" ]
668
669
fn instance ( & self ) -> crate :: BorrowedObject < Self :: Type > ;
669
670
670
671
// rustdoc-stripper-ignore-next
671
672
/// Returns the implementation from an instance.
673
+ #[ deprecated = "Use from_obj() instead" ]
672
674
fn from_instance ( obj : & Self :: Type ) -> & Self ;
673
675
674
676
// rustdoc-stripper-ignore-next
You can’t perform that action at this time.
0 commit comments