Remove `set_abi` from `AbiTransferable`

The `set_abi` trait method is defined, but never used.
This commit is contained in:
Arlie Davis 2021-11-01 08:55:19 -07:00
Родитель 1b2ff64360
Коммит 0129546b5a
1 изменённых файлов: 1 добавлений и 22 удалений

Просмотреть файл

@ -12,8 +12,6 @@ pub unsafe trait AbiTransferable: Sized {
/// Turn the type into the FFI ABI type.
fn get_abi(&self) -> Self::Abi;
/// Set the abi of the implementing type
fn set_abi(&mut self) -> *mut Self::Abi;
/// Convert into a reference to Self from a reference to the ABI
fn from_abi(abi: Self::Abi) -> Self {
@ -58,9 +56,6 @@ macro_rules! primitive_transferable_type {
fn get_abi(&self) -> Self::Abi {
*self
}
fn set_abi(&mut self) -> *mut Self::Abi {
self as *mut Self::Abi
}
})*
};
}
@ -78,6 +73,7 @@ primitive_transferable_type! {
f32,
f64,
usize,
isize,
crate::sys::GUID
}
@ -86,9 +82,6 @@ unsafe impl<T> AbiTransferable for *mut T {
fn get_abi(&self) -> Self::Abi {
*self
}
fn set_abi(&mut self) -> *mut Self::Abi {
self as *mut Self::Abi
}
}
unsafe impl<T> AbiTransferable for *const T {
@ -96,9 +89,6 @@ unsafe impl<T> AbiTransferable for *const T {
fn get_abi(&self) -> Self::Abi {
*self
}
fn set_abi(&mut self) -> *mut Self::Abi {
self as *mut Self::Abi
}
}
unsafe impl<T: crate::Interface> AbiTransferable for T {
@ -106,10 +96,6 @@ unsafe impl<T: crate::Interface> AbiTransferable for T {
fn get_abi(&self) -> Self::Abi {
self.as_raw()
}
fn set_abi(&mut self) -> *mut Self::Abi {
&mut self.as_raw()
}
}
unsafe impl<T: crate::Interface> AbiTransferable for Option<T> {
@ -119,11 +105,4 @@ unsafe impl<T: crate::Interface> AbiTransferable for Option<T> {
.map(|p| p.as_raw().as_ptr())
.unwrap_or(::core::ptr::null_mut())
}
fn set_abi(&mut self) -> *mut Self::Abi {
&mut self
.as_mut()
.map(|p| p.as_raw().as_ptr())
.unwrap_or(::core::ptr::null_mut())
}
}