]> git.proxmox.com Git - proxmox-backup.git/commitdiff
move pbs-tools/src/str.rs to pbs-client/src/pxar/create.rs
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 09:43:22 +0000 (10:43 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 09:43:22 +0000 (10:43 +0100)
Code is only used there.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
pbs-client/src/pxar/create.rs
pbs-tools/src/lib.rs
pbs-tools/src/str.rs [deleted file]

index f705e39984ece676267450610ccc216d82f031bb..92ffeadfb9f2c690baa5fe817ff4cc42c69a0881 100644 (file)
@@ -27,7 +27,6 @@ use proxmox_io::vec;
 use proxmox_lang::c_str;
 
 use pbs_datastore::catalog::BackupCatalogWriter;
-use pbs_tools::str::strip_ascii_whitespace;
 
 use crate::pxar::metadata::errno_is_unsupported;
 use crate::pxar::Flags;
@@ -58,6 +57,17 @@ fn detect_fs_type(fd: RawFd) -> Result<i64, Error> {
     Ok(fs_stat.f_type)
 }
 
+fn strip_ascii_whitespace(line: &[u8]) -> &[u8] {
+    let line = match line.iter().position(|&b| !b.is_ascii_whitespace()) {
+        Some(n) => &line[n..],
+        None => return &[],
+    };
+    match line.iter().rev().position(|&b| !b.is_ascii_whitespace()) {
+        Some(n) => &line[..(line.len() - n)],
+        None => &[],
+    }
+}
+
 #[rustfmt::skip]
 pub fn is_virtual_file_system(magic: i64) -> bool {
     use proxmox_sys::linux::magic::*;
index 96524ce1563224b62442187694e0a43e3cad5316..11c8171c8b0697f123e9ea2f54c2782e92373d38 100644 (file)
@@ -7,7 +7,6 @@ pub mod lru_cache;
 pub mod nom;
 pub mod percent_encoding;
 pub mod sha;
-pub mod str;
 pub mod sync;
 pub mod ticket;
 
diff --git a/pbs-tools/src/str.rs b/pbs-tools/src/str.rs
deleted file mode 100644 (file)
index 5bea241..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-//! String related utilities.
-
-pub fn strip_ascii_whitespace(line: &[u8]) -> &[u8] {
-    let line = match line.iter().position(|&b| !b.is_ascii_whitespace()) {
-        Some(n) => &line[n..],
-        None => return &[],
-    };
-    match line.iter().rev().position(|&b| !b.is_ascii_whitespace()) {
-        Some(n) => &line[..(line.len() - n)],
-        None => &[],
-    }
-}