trim list line, replace GString with String, allow empty value

This commit is contained in:
yggverse 2024-12-03 18:00:29 +02:00
parent c6f747fefd
commit 4741365154

View file

@ -1,7 +1,7 @@
use glib::{GString, Regex, RegexCompileFlags, RegexMatchFlags};
use glib::{Regex, RegexCompileFlags, RegexMatchFlags};
pub struct List {
pub value: GString,
pub value: String,
}
impl List {
@ -15,15 +15,11 @@ impl List {
);
// Detect value
let value = regex.get(1)?;
if value.trim().is_empty() {
return None;
}
let value = regex.get(1)?.trim();
// Result
Some(Self {
value: GString::from(value.as_str()),
value: String::from(value),
})
}
}