Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: rename variables for clarity in the virtual_methods example #1484

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading