Skip to content

Commit f8dd2b4

Browse files
committed
Revert changes to alpm list
While this technically makes things more generic, it breaks existing code. Wait for v3 for a better rework.
1 parent 23cd6fb commit f8dd2b4

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

alpm/src/deps.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::utils::*;
2-
use crate::{free, Alpm, AlpmList, AlpmListMut, Db, IntoRawAlpmList, Package, Pkg, Ver};
2+
use crate::{free, Alpm, AlpmList, AlpmListMut, Db, IntoRawAlpmList, Package, Ver};
33

44
use alpm_sys::alpm_depmod_t::*;
55
use alpm_sys::*;
@@ -343,9 +343,9 @@ impl<'a> AlpmList<'a, Package<'a>> {
343343
impl Alpm {
344344
pub fn check_deps<'a>(
345345
&self,
346-
pkgs: impl IntoRawAlpmList<'a, Pkg<'a>>,
347-
rem: impl IntoRawAlpmList<'a, Pkg<'a>>,
348-
upgrade: impl IntoRawAlpmList<'a, Pkg<'a>>,
346+
pkgs: impl IntoRawAlpmList<'a, Package<'a>>,
347+
rem: impl IntoRawAlpmList<'a, Package<'a>>,
348+
upgrade: impl IntoRawAlpmList<'a, Package<'a>>,
349349
reverse_deps: bool,
350350
) -> AlpmListMut<DependMissing> {
351351
let reverse_deps = if reverse_deps { 1 } else { 0 };

alpm/src/list.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,28 @@ where
9393
unsafe fn into_raw_alpm_list(self) -> RawAlpmList<'a, T, Self::Drop>;
9494
}
9595

96+
impl<'a> IntoRawAlpmList<'a, Pkg<'a>> for AlpmList<'a, LoadedPackage<'a>> {
97+
type Drop = False;
98+
unsafe fn into_raw_alpm_list(self) -> RawAlpmList<'a, Pkg<'a>, Self::Drop> {
99+
RawAlpmList {
100+
list: self.list,
101+
_marker1: PhantomData,
102+
_marker2: PhantomData,
103+
}
104+
}
105+
}
106+
107+
impl<'a> IntoRawAlpmList<'a, Pkg<'a>> for AlpmList<'a, Package<'a>> {
108+
type Drop = False;
109+
unsafe fn into_raw_alpm_list(self) -> RawAlpmList<'a, Pkg<'a>, Self::Drop> {
110+
RawAlpmList {
111+
list: self.list,
112+
_marker1: PhantomData,
113+
_marker2: PhantomData,
114+
}
115+
}
116+
}
117+
96118
impl<'a, T> IntoRawAlpmList<'a, T> for AlpmList<'a, T>
97119
where
98120
T: AsAlpmListItemPtr<'a>,
@@ -643,7 +665,7 @@ unsafe impl<'a> AsAlpmListItemPtr<'a> for Pkg<'a> {
643665
}
644666

645667
unsafe impl<'a> AsAlpmListItemPtr<'a> for Package<'a> {
646-
type Output = Pkg<'a>;
668+
type Output = Package<'a>;
647669

648670
fn as_ptr(&self) -> *mut c_void {
649671
self.pkg.as_ptr() as *mut c_void
@@ -715,34 +737,12 @@ unsafe impl<'a> Push<'a> for Depend {}
715737
unsafe impl<'a> Push<'a> for Dep<'a> {}
716738

717739
unsafe impl<'a, 'b> IntoAlpmListItem<'a, 'b> for Package<'a> {
718-
type Borrow = Pkg<'a>;
719-
unsafe fn ptr_into_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self {
720-
Package::new(handle, ptr as *mut alpm_pkg_t)
721-
}
722-
unsafe fn ptr_as_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self::Borrow {
723-
Package::new(handle, ptr as *mut alpm_pkg_t).pkg
724-
}
725-
}
726-
727-
unsafe impl<'a, 'b> IntoAlpmListItem<'a, 'b> for Pkg<'a> {
728740
type Borrow = Self;
729741
unsafe fn ptr_into_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self {
730-
Package::new(handle, ptr as *mut alpm_pkg_t).pkg
731-
}
732-
unsafe fn ptr_as_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self::Borrow {
733-
Package::new(handle, ptr as *mut alpm_pkg_t).pkg
734-
}
735-
}
736-
737-
unsafe impl<'a, 'b> IntoAlpmListItem<'a, 'b> for LoadedPackage<'a> {
738-
type Borrow = Pkg<'a>;
739-
unsafe fn ptr_into_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self {
740-
LoadedPackage {
741-
pkg: Package::new(handle, ptr as *mut alpm_pkg_t).pkg,
742-
}
742+
Package::new(handle, ptr as *mut alpm_pkg_t)
743743
}
744744
unsafe fn ptr_as_alpm_list_item(handle: &'a Alpm, ptr: *mut c_void) -> Self::Borrow {
745-
Package::new(handle, ptr as *mut alpm_pkg_t).pkg
745+
Package::new(handle, ptr as *mut alpm_pkg_t)
746746
}
747747
}
748748

0 commit comments

Comments
 (0)