mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 17:15:33 +00:00
replace GString with String
This commit is contained in:
parent
155247a2ea
commit
3b9c1b1b1c
1 changed files with 4 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use glib::{GString, Regex, RegexCompileFlags, RegexMatchFlags};
|
use glib::{Regex, RegexCompileFlags, RegexMatchFlags};
|
||||||
|
|
||||||
/// [Header](https://geminiprotocol.net/docs/gemtext-specification.gmi#heading-lines) type holder
|
/// [Header](https://geminiprotocol.net/docs/gemtext-specification.gmi#heading-lines) type holder
|
||||||
pub enum Level {
|
pub enum Level {
|
||||||
|
|
@ -9,7 +9,7 @@ pub enum Level {
|
||||||
|
|
||||||
/// [Header](https://geminiprotocol.net/docs/gemtext-specification.gmi#heading-lines) entity holder
|
/// [Header](https://geminiprotocol.net/docs/gemtext-specification.gmi#heading-lines) entity holder
|
||||||
pub struct Header {
|
pub struct Header {
|
||||||
pub value: GString,
|
pub value: String,
|
||||||
pub level: Level,
|
pub level: Level,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,16 +37,13 @@ impl Header {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Detect header value
|
// Detect header value
|
||||||
let value = regex.get(2)?;
|
let value = regex.get(2)?.to_string();
|
||||||
|
|
||||||
if value.trim().is_empty() {
|
if value.trim().is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result
|
// Result
|
||||||
Some(Self {
|
Some(Self { level, value })
|
||||||
level,
|
|
||||||
value: GString::from(value.as_str()),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue