[−][src]Struct cursive::views::TextContent
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!(view.get_content().source().contains("new"));
Implementations
impl TextContent
[src]
pub fn new<S>(content: S) -> TextContent where
S: Into<SpannedString<Style>>,
[src]
S: Into<SpannedString<Style>>,
Creates a new text content around the given value.
Parses the given value.
impl TextContent
[src]
pub fn set_content<S>(&self, content: S) where
S: Into<SpannedString<Style>>,
[src]
S: Into<SpannedString<Style>>,
Replaces the content with the given value.
pub fn append<S>(&self, content: S) where
S: Into<SpannedString<Style>>,
[src]
S: Into<SpannedString<Style>>,
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.
pub fn with_content<F, O>(&self, f: F) -> O where
F: FnOnce(&mut SpannedString<Style>) -> O,
[src]
F: FnOnce(&mut SpannedString<Style>) -> O,
Apply the given closure to the inner content, and bust the cache afterward.
Trait Implementations
impl Clone for TextContent
[src]
pub fn clone(&self) -> TextContent
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for TextContent
[src]
impl Send for TextContent
[src]
impl Sync for TextContent
[src]
impl Unpin for TextContent
[src]
impl UnwindSafe for TextContent
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> With for T
[src]
pub fn wrap_with<U, F>(self, f: F) -> U where
F: FnOnce(Self) -> U,
[src]
F: FnOnce(Self) -> U,
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
pub fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
pub fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),