move pbs-tools/src/str.rs to pbs-client/src/pxar/create.rs

Code is only used there.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2021-11-25 10:43:22 +01:00
parent 8a8a1850d0
commit 92ef0b56d8
3 changed files with 11 additions and 14 deletions

View 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::*;

View 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;

View File

@ -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 => &[],
}
}