Skip to main content

StoredRecord

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

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)

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

The record’s identity.

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>

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>

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>

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 undo(&self) -> bool

Undo the person’s last edit of this record. Whether there was one.

pub fn redo(&self) -> bool

Redo the person’s last undone edit of this record.

pub fn route(&self) -> Option<RouteSpec>

The route this record syncs on. None for a record kept on this device only.

pub fn syncs(&self) -> bool

Whether this record syncs to other devices.

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>

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 document(&self) -> Option<Vec<u8>>

The whole record, as this device would send it to another.

pub fn flush(&self)

Write out what is not stored yet.

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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 T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,