Skip to content

Commit

Permalink
(Re)add deprecated ivar methods
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 4, 2022
1 parent 75a1a08 commit ad53feb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions objc2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased - YYYY-MM-DD

### Added
* Added deprecated `Object::get_ivar` and `Object::get_mut_ivar` to make
upgrading easier.


## 0.3.0-alpha.6 - 2022-01-03

Expand Down
14 changes: 14 additions & 0 deletions objc2/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,13 @@ impl Object {
unsafe { &*ptr }
}

/// Use [`ivar`](`Self::ivar`) instead.
#[deprecated = "Use `Object::ivar` instead."]
pub unsafe fn get_ivar<T: Encode>(&self, name: &str) -> &T {
// SAFETY: Upheld by caller
unsafe { self.ivar(name) }
}

/// Returns a mutable reference to the ivar with the given name.
///
/// # Panics
Expand All @@ -577,6 +584,13 @@ impl Object {
unsafe { &mut *ptr }
}

/// Use [`ivar_mut`](`Self::ivar_mut`) instead.
#[deprecated = "Use `Object::ivar_mut` instead."]
pub unsafe fn get_mut_ivar<T: Encode>(&mut self, name: &str) -> &mut T {
// SAFETY: Upheld by caller
unsafe { self.ivar_mut(name) }
}

/// Sets the value of the ivar with the given name.
///
/// # Panics
Expand Down

0 comments on commit ad53feb

Please sign in to comment.