[][src]Struct cursive::views::TextContent

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!(view.get_content().source().contains("new"));

Methods

impl TextContent[src]

pub fn new<S>(content: S) -> Self where
    S: Into<StyledString>, 
[src]

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]

Replaces the content with the given value.

pub fn append<S>(&mut self, content: S) where
    S: Into<StyledString>, 
[src]

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_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T[src]