mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 07:54:14 +00:00
implement self construction
This commit is contained in:
parent
c499f10320
commit
6aedb21794
@ -76,7 +76,7 @@ Quick start guide and maintenance protocol
|
|||||||
* implementable `struct` is public, where it members - private
|
* implementable `struct` is public, where it members - private
|
||||||
* contain main `struct` implementation:
|
* contain main `struct` implementation:
|
||||||
* at least one constructor that must:
|
* at least one constructor that must:
|
||||||
* have common for application name: `new` or/and `new_arc`, `new_mutex`, etc - on return object in container
|
* have common for application names: `from`, `new` or/and `new_arc`, `new_mutex`, etc - on return object in container
|
||||||
* grant ownership for new `Self` object created
|
* grant ownership for new `Self` object created
|
||||||
* public `activate` action if the new object can not be activated on construct
|
* public `activate` action if the new object can not be activated on construct
|
||||||
* public `link` getter for GTK `widget` (parental composition)
|
* public `link` getter for GTK `widget` (parental composition)
|
||||||
|
@ -57,7 +57,7 @@ impl Reader {
|
|||||||
markup.push_str(Plain::from(line).markup())
|
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
|
// Init widget
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
use gtk::glib::{gformat, GString};
|
use gtk::glib::{gformat, GString};
|
||||||
|
|
||||||
pub struct Plain {
|
pub struct Plain {
|
||||||
// nothing yet..
|
line: GString,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Plain {
|
impl Plain {
|
||||||
pub fn from(line: &str) -> GString {
|
// Construct
|
||||||
gformat!("{}\n", line)
|
pub fn from(line: &str) -> Self {
|
||||||
|
Self {
|
||||||
|
line: gformat!("{}\n", line),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
pub fn as_str(&self) -> &str {
|
||||||
|
self.line.as_str()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user