Struct cursive::views::TextContent
[−]
[src]
pub struct TextContent { /* fields omitted */ }
Provides access to the content of a TextView
.
Cloning this object will still point to the same content.
Examples
let mut content = TextContent::new("content"); let view = TextView::new_with_content(content.clone()); // Later, possibly in a different thread content.set_content("new content"); assert!(content.get_content().source().contains("new"));
Methods
impl TextContent
[src]
pub fn new<S>(content: S) -> Self where
S: Into<StyledString>,
[src]
S: Into<StyledString>,
Creates a new text content around the given value.
Parses the given value.
impl TextContent
[src]
pub fn set_content<S>(&mut self, content: S) where
S: Into<StyledString>,
[src]
S: Into<StyledString>,
Replaces the content with the given value.
pub fn append<S>(&mut self, content: S) where
S: Into<StyledString>,
[src]
S: Into<StyledString>,
Append content
to the end of a TextView
.
pub fn get_content(&self) -> TextContentRef
[src]
Returns a reference to the content.
This locks the data while the returned value is alive, so don't keep it too long.
Trait Implementations
impl Clone for TextContent
[src]
fn clone(&self) -> TextContent
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more