Skip to content

Commit

Permalink
examples: rename variables for clarity in the virtual_methods example
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Borelli authored and sdroege committed Aug 27, 2024
1 parent 9e2333a commit efdf85c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/virtual_methods/purrable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ pub trait PurrableExt: IsA<Purrable> {
/// Return the current purring status
fn is_purring(&self) -> bool {
let this = self.upcast_ref::<Purrable>();
let class = this.interface::<Purrable>().unwrap();
(class.as_ref().is_purring)(this)
let iface = this.interface::<Purrable>().unwrap();
(iface.as_ref().is_purring)(this)
}
}

Expand All @@ -99,9 +99,9 @@ pub trait PurrableImplExt: PurrableImpl {
/// Chains up to the parent implementation of [`PurrableExt::is_purring`]
fn parent_is_purring(&self) -> bool {
let data = Self::type_data();
let parent_class =
let parent_iface =
unsafe { &*(data.as_ref().parent_interface::<Purrable>() as *const ffi::Interface) };
let is_purring = parent_class.is_purring;
let is_purring = parent_iface.is_purring;

is_purring(unsafe { self.obj().unsafe_cast_ref() })
}
Expand Down

0 comments on commit efdf85c

Please sign in to comment.