Struct StoredRecord
pub struct StoredRecord { /* private fields */ }Expand description
A record held beside the one an app shows: the app’s own of a kind, one
of the person’s, or one of the workspace’s (super::workspace), each
held the same way. Edits are attributed to the person, recorded as undo
steps of their own and synced on the record’s route where it has one.
Implementations§
§impl StoredRecord
impl StoredRecord
pub fn publishes(&self) -> bool
pub fn publishes(&self) -> bool
Whether this app publishes the record’s changes on its route.
The identity service signs a change only for the route’s own app, and for the workspace’s shared records: never for another app’s record, its keeper’s or its editors’. A window of an app that only reads another app’s record joins its route and merges what comes back; nothing local is sent there, and a change that was would be refused a signature — which stops the whole collaboration, not one record.
pub fn wake_on_arrival(&self, reader: WakeHandle)
pub fn wake_on_arrival(&self, reader: WakeHandle)
Wake the window reader belongs to whenever another replica’s change
to the records kept with this one arrives
(RecordStore::wake_on_arrival).
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.
pub fn try_edit<T>(
&self,
undoable: bool,
edit: impl FnOnce(&mut AutoCommit) -> Result<T, String>,
) -> Result<Result<T, String>, HistoryUnavailable>
pub fn try_edit<T>( &self, undoable: bool, edit: impl FnOnce(&mut AutoCommit) -> Result<T, String>, ) -> Result<Result<T, String>, HistoryUnavailable>
Self::edit, telling a record that cannot be changed right now
(HistoryUnavailable) from an edit that refused: edit did not
run then, and may run once whatever holds the record lets go.
§Errors
Why the record cannot be changed now.
pub fn route(&self) -> Option<RouteSpec>
pub fn route(&self) -> Option<RouteSpec>
The route this record syncs on. 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 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 workspace whose route carries the record. None for a record the
person keeps in their own scope, which carries no content of its own,
and for one kept on this device only.
Auto Trait Implementations§
impl Freeze for StoredRecord
impl !RefUnwindSafe for StoredRecord
impl !Send for StoredRecord
impl !Sync for StoredRecord
impl Unpin for StoredRecord
impl UnsafeUnpin for StoredRecord
impl !UnwindSafe for StoredRecord
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> 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>, which can then be
downcast into Box<dyn 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>, which 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