diff --git a/README.md b/README.md index 0a6538c8..235e416c 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ Quick start guide and maintenance protocol * implementable `struct` is public, where it members - private * contain main `struct` implementation: * 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 * public `activate` action if the new object can not be activated on construct * public `link` getter for GTK `widget` (parental composition) diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs index c242652b..4dbc0766 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs @@ -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 diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/parser/plain.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/parser/plain.rs index ca0b301a..0bde3823 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/parser/plain.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/parser/plain.rs @@ -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() } }