From 1349f24d4935cf943a97a1a79e4a5b5c49cfe0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 19 Aug 2022 12:26:42 +0200 Subject: [PATCH] schema: update to textwrap 0.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- proxmox-schema/Cargo.toml | 2 +- proxmox-schema/src/format.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxmox-schema/Cargo.toml b/proxmox-schema/Cargo.toml index b8ff6a6d..ea03237e 100644 --- a/proxmox-schema/Cargo.toml +++ b/proxmox-schema/Cargo.toml @@ -14,7 +14,7 @@ lazy_static = "1.4" regex = "1.5" serde = "1.0" serde_json = "1.0" -textwrap = "0.11" +textwrap = "0.15" # the upid type needs this for 'getpid' libc = { version = "0.2", optional = true } diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs index 08012146..4e497ba5 100644 --- a/proxmox-schema/src/format.rs +++ b/proxmox-schema/src/format.rs @@ -37,11 +37,11 @@ pub fn wrap_text( text: &str, columns: usize, ) -> String { - let wrapper1 = textwrap::Wrapper::new(columns) + let wrap_options1 = textwrap::Options::new(columns) .initial_indent(initial_indent) .subsequent_indent(subsequent_indent); - let wrapper2 = textwrap::Wrapper::new(columns) + let wrap_options2 = textwrap::Options::new(columns) .initial_indent(subsequent_indent) .subsequent_indent(subsequent_indent); @@ -50,9 +50,9 @@ pub fn wrap_text( .filter(|p| !p.is_empty()) .fold(String::new(), |mut acc, p| { if acc.is_empty() { - acc.push_str(&wrapper1.wrap(p).join("\n")); + acc.push_str(&textwrap::wrap(p, &wrap_options1).join("\n")); } else { - acc.push_str(&wrapper2.wrap(p).join("\n")); + acc.push_str(&textwrap::wrap(p, &wrap_options2).join("\n")); } acc.push_str("\n\n"); acc