pub struct Text { /* private fields */ }Expand description
One text cell. Cheap to clone; every clone is the same place.
Implementations§
Source§impl Text
impl Text
pub fn id(&self) -> TextId
pub fn len(&self) -> Result<usize>
pub fn is_empty(&self) -> Result<bool>
Sourcepub fn append(&self, text: &str) -> Result<usize>
pub fn append(&self, text: &str) -> Result<usize>
Append to the text, atomically with respect to every other writer; refused whole, never cut, when the result would not fit.
Sourcepub fn release(self) -> Result<()>
pub fn release(self) -> Result<()>
Give the cell back; this and every other handle to it go stale.
Sourcepub fn version(&self) -> Result<u32>
pub fn version(&self) -> Result<u32>
The seqlock sequence at rest, the thing Self::wait_changed waits
on. Take it before Self::load and the wait misses nothing.
Sourcepub fn wait_changed(&self, since: u32) -> Result<u32>
pub fn wait_changed(&self, since: u32) -> Result<u32>
Park until the text has been written since since, then return the
sequence now. A released cell wakes every waiter with
Error::StaleText. Blocking; an async runtime wraps it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Text
impl !UnwindSafe for Text
impl Freeze for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more