From 9c24713d8e68d0cb38784f04d81b0ba2f575cd3f Mon Sep 17 00:00:00 2001 From: Xavier Date: Thu, 14 Mar 2024 11:38:53 -0400 Subject: [PATCH 1/2] Alter function signature to accept borrowed &Package objects --- alpm/src/remove.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alpm/src/remove.rs b/alpm/src/remove.rs index 801edca..7246265 100644 --- a/alpm/src/remove.rs +++ b/alpm/src/remove.rs @@ -3,7 +3,7 @@ use crate::{Alpm, Package, Result}; use alpm_sys::*; impl Alpm { - pub fn trans_remove_pkg(&self, pkg: Package) -> Result<()> { + pub fn trans_remove_pkg(&self, pkg: &Package) -> Result<()> { let ret = unsafe { alpm_remove_pkg(self.as_ptr(), pkg.as_ptr()) }; self.check_ret(ret) } From e44d7b44e7c20f999d1bd9ea75555d8162b6a3d5 Mon Sep 17 00:00:00 2001 From: Xavier Date: Thu, 14 Mar 2024 11:43:01 -0400 Subject: [PATCH 2/2] Derive Copy, Clone for bitflags attributes --- alpm/src/trans.rs | 2 +- alpm/src/types.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/alpm/src/trans.rs b/alpm/src/trans.rs index ea46eff..1eab7d4 100644 --- a/alpm/src/trans.rs +++ b/alpm/src/trans.rs @@ -12,7 +12,7 @@ use std::ptr; use bitflags::bitflags; bitflags! { - #[derive(Debug, PartialEq, Eq)] + #[derive(Debug, PartialEq, Eq, Copy, Clone)] pub struct TransFlag: u32 { const NONE = 0; const NO_DEPS = ALPM_TRANS_FLAG_NODEPS; diff --git a/alpm/src/types.rs b/alpm/src/types.rs index 96cd0c5..06f1ae8 100644 --- a/alpm/src/types.rs +++ b/alpm/src/types.rs @@ -35,7 +35,7 @@ pub enum FetchResult { } bitflags! { - #[derive(Debug, PartialEq, Eq)] + #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct SigLevel: u32 { const NONE = 0; const PACKAGE = ALPM_SIG_PACKAGE; @@ -51,7 +51,7 @@ bitflags! { } bitflags! { - #[derive(Debug, PartialEq, Eq)] + #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct Usage: u32 { const NONE = 0; const SYNC = ALPM_DB_USAGE_SYNC; @@ -63,7 +63,7 @@ bitflags! { } bitflags! { - #[derive(Debug, PartialEq, Eq)] + #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct LogLevel: u32 { const NONE = 0; const ERROR = ALPM_LOG_ERROR; @@ -104,7 +104,7 @@ pub enum PackageReason { } bitflags! { - #[derive(Debug, PartialEq, Eq)] + #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct PackageValidation: u32 { const UNKNOWN = ALPM_PKG_VALIDATION_UNKNOWN; const NONE = ALPM_PKG_VALIDATION_NONE;