Struct PersonRecord
pub struct PersonRecord { /* private fields */ }Expand description
One of the person’s records, open. Edits are attributed to the person, recorded as undo steps of their own and synced on the record’s route.
Implementations§
§impl PersonRecord
impl PersonRecord
pub fn checkout(&self) -> &RecordCheckout
pub fn checkout(&self) -> &RecordCheckout
The record’s identity.
pub fn read<T>(&self, read: impl FnOnce(&AutoCommit) -> T) -> Option<T>
pub fn read<T>(&self, read: impl FnOnce(&AutoCommit) -> T) -> Option<T>
Read the record’s document; None while its owner is busy.
pub fn heads(&self) -> Vec<ChangeHash>
pub fn heads(&self) -> Vec<ChangeHash>
The record’s heads: they change with every edit here or merged from another device.
pub fn edit<T>(
&self,
undoable: bool,
edit: impl FnOnce(&mut AutoCommit) -> Result<T, String>,
) -> Result<T, String>
pub fn edit<T>( &self, undoable: bool, edit: impl FnOnce(&mut AutoCommit) -> Result<T, String>, ) -> Result<T, String>
Edit the record: edit changes the document, written and synced
like any edit. An undoable change is one undo step of the
person’s; another (content from outside, housekeeping) is nobody’s.
§Errors
The record is busy, or edit failed (nothing is recorded then).
pub fn route(&self) -> Option<RouteSpec>
pub fn route(&self) -> Option<RouteSpec>
The route this record syncs on: the person’s room, when they have
one. None for a record kept on this device only.
pub fn history_owner(&self) -> HistoryOwner
pub fn history_owner(&self) -> HistoryOwner
The record’s owner for its collaboration route, which a widget
reports from Widget::record_owners
so the runtime publishes its edits and merges the person’s other
devices’ while it is open.
pub fn merge_peer_document(&self, document: Vec<u8>) -> Result<bool, String>
pub fn merge_peer_document(&self, document: Vec<u8>) -> Result<bool, String>
Merge a whole document of this record another device holds, as its route would. For hosts and tests that carry the record themselves.
§Errors
The bytes are not this record’s document.
pub fn flush(&self)
pub fn flush(&self)
Write out what is not stored yet.
pub fn content(&self) -> Option<ContentStore>
pub fn content(&self) -> Option<ContentStore>
Where the content this record references is stored and read: under
the person’s own room, kept by the host and carried to the person’s
other devices on the record’s route — never in the room of the
window showing it. None without a person room, where the record
stays on this device and keeps no content of its own.
Auto Trait Implementations§
impl Freeze for PersonRecord
impl !RefUnwindSafe for PersonRecord
impl !Send for PersonRecord
impl !Sync for PersonRecord
impl Unpin for PersonRecord
impl UnsafeUnpin for PersonRecord
impl !UnwindSafe for PersonRecord
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more