mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement self construction
This commit is contained in:
parent
c499f10320
commit
6aedb21794
3 changed files with 13 additions and 5 deletions
|
|
@ -57,7 +57,7 @@ impl Reader {
|
|||
markup.push_str(Plain::from(line).markup())
|
||||
*/
|
||||
|
||||
buffer.insert(&mut buffer.end_iter(), &Plain::from(line));
|
||||
buffer.insert(&mut buffer.end_iter(), Plain::from(line).as_str());
|
||||
}
|
||||
|
||||
// Init widget
|
||||
|
|
|
|||
|
|
@ -1,11 +1,19 @@
|
|||
use gtk::glib::{gformat, GString};
|
||||
|
||||
pub struct Plain {
|
||||
// nothing yet..
|
||||
line: GString,
|
||||
}
|
||||
|
||||
impl Plain {
|
||||
pub fn from(line: &str) -> GString {
|
||||
gformat!("{}\n", line)
|
||||
// Construct
|
||||
pub fn from(line: &str) -> Self {
|
||||
Self {
|
||||
line: gformat!("{}\n", line),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.line.as_str()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue