Trait piet::TextStorage[][src]

pub trait TextStorage: 'static {
    fn as_str(&self) -> &str;
}
Expand description

A type that stores text.

This allows the client to more completely control how text is stored. If you do not care about this, implementations are provided for String, Arc<str>, and Rc<str>.

This has a 'static bound because the inner type will be behind a shared pointer.

Implementors

This trait expects immutable data. Mutating the data (using interior mutability) May cause any TextLayout objects using this TextStorage to become inconsistent.

Required methods

Return the underlying text as a contiguous buffer.

Types that do not store their text as a contiguous buffer (such as ropes or gap buffers) will need to use a wrapper to maintain a separate contiguous buffer as required.

In practice, these types should be using a TextLayout object per paragraph, and in general a separate buffer will be unnecessary.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Implementations on Foreign Types

Implementors