new rustfmt
This commit is contained in:
parent
1d2364d800
commit
2f2167c027
2
build.rs
2
build.rs
@ -10,7 +10,7 @@ fn main() {
|
||||
build.cpp(true);
|
||||
build.flag("-std=gnu++11");
|
||||
|
||||
#[cfg(feature="ye-olde-apt")]
|
||||
#[cfg(feature = "ye-olde-apt")]
|
||||
{
|
||||
build.define("YE_OLDE_APT", "1");
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
extern crate apt_pkg_native;
|
||||
use std::env;
|
||||
|
||||
use apt_pkg_native::simple;
|
||||
use apt_pkg_native::Cache;
|
||||
use apt_pkg_native::simple;
|
||||
|
||||
fn main() {
|
||||
let pkg = env::args()
|
||||
|
@ -1,5 +1,5 @@
|
||||
use std::ops::Deref;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
|
||||
pub trait RawIterator {
|
||||
type View;
|
||||
@ -101,7 +101,6 @@ where
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
pub fn all<F>(mut self, mut f: F) -> bool
|
||||
where
|
||||
F: FnMut(&R::View) -> bool,
|
||||
|
13
src/raw.rs
13
src/raw.rs
@ -2,11 +2,10 @@
|
||||
/// * `*mut c_void` are to be released by the appropriate function
|
||||
/// * `*const c_chars` are short-term borrows
|
||||
/// * `*mut c_chars` are to be freed by `libc::free`.
|
||||
|
||||
use std::sync::Mutex;
|
||||
|
||||
use libc::c_void;
|
||||
use libc::c_char;
|
||||
use libc::c_void;
|
||||
|
||||
pub type PCache = *mut c_void;
|
||||
pub type PPkgIterator = *mut c_void;
|
||||
@ -43,7 +42,6 @@ extern "C" {
|
||||
pub fn pkg_iter_next(iterator: PPkgIterator);
|
||||
pub fn pkg_iter_end(iterator: PPkgIterator) -> bool;
|
||||
|
||||
|
||||
// Package iterator accessors
|
||||
// ==========================
|
||||
|
||||
@ -52,7 +50,6 @@ extern "C" {
|
||||
pub fn pkg_iter_current_version(iterator: PPkgIterator) -> *const c_char;
|
||||
pub fn pkg_iter_candidate_version(iterator: PPkgIterator) -> *const c_char;
|
||||
|
||||
|
||||
// Version iterators
|
||||
// =================
|
||||
|
||||
@ -68,14 +65,14 @@ extern "C" {
|
||||
pub fn ver_iter_version(iterator: PVerIterator) -> *mut c_char;
|
||||
pub fn ver_iter_section(iterator: PVerIterator) -> *mut c_char;
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn ver_iter_source_package(iterator: PVerIterator) -> *mut c_char;
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn ver_iter_source_version(iterator: PVerIterator) -> *mut c_char;
|
||||
pub fn ver_iter_arch(iterator: PVerIterator) -> *mut c_char;
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn ver_iter_priority(iterator: PVerIterator) -> i32;
|
||||
|
||||
pub fn ver_iter_ver_file_iter(iterator: PVerIterator) -> PVerFileIterator;
|
||||
@ -84,14 +81,12 @@ extern "C" {
|
||||
pub fn ver_file_iter_next(iterator: PVerFileIterator);
|
||||
pub fn ver_file_iter_end(iterator: PVerFileIterator) -> bool;
|
||||
|
||||
|
||||
pub fn ver_file_iter_pkg_file_iter(iterator: PVerFileIterator) -> PPkgFileIterator;
|
||||
pub fn pkg_file_iter_release(iterator: PPkgFileIterator);
|
||||
|
||||
pub fn pkg_file_iter_next(iterator: PPkgFileIterator);
|
||||
pub fn pkg_file_iter_end(iterator: PPkgFileIterator) -> bool;
|
||||
|
||||
|
||||
pub fn pkg_file_iter_file_name(iterator: PPkgFileIterator) -> *const c_char;
|
||||
pub fn pkg_file_iter_archive(iterator: PPkgFileIterator) -> *const c_char;
|
||||
pub fn pkg_file_iter_version(iterator: PPkgFileIterator) -> *const c_char;
|
||||
|
@ -146,7 +146,6 @@ impl<'c> RawIterator for PkgIterator<'c> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Actual accessors
|
||||
impl<'c> PkgView<'c> {
|
||||
pub fn name(&self) -> String {
|
||||
@ -238,7 +237,7 @@ impl<'c> VerView<'c> {
|
||||
unsafe { make_owned_ascii_string(raw::ver_iter_section(self.ptr)) }
|
||||
}
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn source_package(&self) -> String {
|
||||
unsafe {
|
||||
make_owned_ascii_string(raw::ver_iter_source_package(self.ptr))
|
||||
@ -246,7 +245,7 @@ impl<'c> VerView<'c> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn source_version(&self) -> String {
|
||||
unsafe {
|
||||
make_owned_ascii_string(raw::ver_iter_source_version(self.ptr))
|
||||
@ -254,7 +253,7 @@ impl<'c> VerView<'c> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub fn priority(&self) -> i32 {
|
||||
unsafe { raw::ver_iter_priority(self.ptr) }
|
||||
}
|
||||
@ -283,7 +282,6 @@ pub struct VerFileView<'c> {
|
||||
ptr: raw::PVerFileIterator,
|
||||
}
|
||||
|
||||
|
||||
impl<'c> RawIterator for VerFileIterator<'c> {
|
||||
type View = VerFileView<'c>;
|
||||
|
||||
@ -321,7 +319,6 @@ impl<'c> VerFileView<'c> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// An "iterator"/pointer to a point in a file list.
|
||||
pub struct PkgFileIterator<'c> {
|
||||
cache: PhantomData<&'c MutexGuard<'c, raw::CacheHolder>>,
|
||||
|
@ -42,26 +42,25 @@ pub struct Version {
|
||||
pub arch: String,
|
||||
pub section: Option<String>,
|
||||
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub source_package: String,
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub source_version: String,
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
pub priority: i32,
|
||||
}
|
||||
|
||||
|
||||
impl Version {
|
||||
pub fn new(view: &sane::VerView) -> Self {
|
||||
Version {
|
||||
version: view.version(),
|
||||
arch: view.arch(),
|
||||
section: view.section(),
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
source_package: view.source_package(),
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
source_version: view.source_version(),
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
priority: view.priority(),
|
||||
}
|
||||
}
|
||||
@ -73,13 +72,11 @@ impl fmt::Display for Version {
|
||||
if let Some(ref section) = self.section {
|
||||
write!(f, " in {}", section)?;
|
||||
}
|
||||
#[cfg(not(feature="ye-olde-apt"))]
|
||||
#[cfg(not(feature = "ye-olde-apt"))]
|
||||
write!(
|
||||
f,
|
||||
" from {}:{} at {}",
|
||||
self.source_package,
|
||||
self.source_version,
|
||||
self.priority,
|
||||
self.source_package, self.source_version, self.priority,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
@ -166,7 +163,6 @@ impl VersionOrigins {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BinaryPackageVersions {
|
||||
pub pkg: BinaryPackage,
|
||||
|
Loading…
x
Reference in New Issue
Block a user