Struct cursive::views::TextContent
source · pub struct TextContent { /* private fields */ }
Expand description
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"));
Implementations
sourceimpl TextContent
impl TextContent
sourcepub fn new<S>(content: S) -> Selfwhere
S: Into<StyledString>,
pub fn new<S>(content: S) -> Selfwhere
S: Into<StyledString>,
Creates a new text content around the given value.
Parses the given value.
sourceimpl TextContent
impl TextContent
sourcepub fn set_content<S>(&mut self, content: S)where
S: Into<StyledString>,
pub fn set_content<S>(&mut self, content: S)where
S: Into<StyledString>,
Replaces the content with the given value.
sourcepub fn append<S>(&mut self, content: S)where
S: Into<StyledString>,
pub fn append<S>(&mut self, content: S)where
S: Into<StyledString>,
Append content
to the end of a TextView
.
sourcepub fn get_content(&self) -> TextContentRef
pub fn get_content(&self) -> TextContentRef
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
sourceimpl Clone for TextContent
impl Clone for TextContent
sourcefn clone(&self) -> TextContent
fn clone(&self) -> TextContent
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for TextContent
impl Send for TextContent
impl Sync for TextContent
impl Unpin for TextContent
impl UnwindSafe for TextContent
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more