Struct Store

Source
pub struct Store<'a, T, R> { /* private fields */ }
Expand description

Storage for collaborative objects of a specific type T in a single repository.

Implementations§

Source§

impl<'a, T, R> Store<'a, T, R>
where R: ReadRepository + Store,

Source

pub fn open_for( type_name: &'a TypeName, repo: &'a R, ) -> Result<Store<'a, T, R>, Error>

Open a new generic store.

Source

pub fn identity(self, identity: Oid) -> Store<'a, T, R>

Return a new store with the attached identity.

Source§

impl<'a, T, R> Store<'a, T, R>
where R: ReadRepository + Store<Namespace = PublicKey>, T: CobWithType,

Source

pub fn open(repo: &'a R) -> Result<Store<'a, T, R>, Error>

Open a new generic store.

Source§

impl<T, R> Store<'_, T, R>
where R: ReadRepository + Store<Namespace = PublicKey>, T: Cob + Evaluate<R>,

Source

pub fn transaction( &self, actions: Vec<<T as Cob>::Action>, embeds: Vec<Embed<Uri>>, ) -> Transaction<T, R>

Source§

impl<T, R> Store<'_, T, R>
where R: ReadRepository + SignRepository + Store<Namespace = PublicKey>, T: Cob + Evaluate<R>, <T as Cob>::Action: Serialize,

Source

pub fn update<G>( &self, type_name: &TypeName, object_id: ObjectId, message: &str, actions: impl Into<NonEmpty<<T as Cob>::Action>>, embeds: Vec<Embed<Uri>>, signer: &Device<G>, ) -> Result<Updated<T>, Error>
where G: Signer<Signature>,

Update an object.

Source

pub fn create<G>( &self, message: &str, actions: impl Into<NonEmpty<<T as Cob>::Action>>, embeds: Vec<Embed<Uri>>, signer: &Device<G>, ) -> Result<(ObjectId, T), Error>
where G: Signer<Signature>,

Create an object.

Source

pub fn remove<G>(&self, id: &ObjectId, signer: &Device<G>) -> Result<(), Error>
where G: Signer<Signature>,

Remove an object.

Source§

impl<'a, T, R> Store<'a, T, R>
where R: ReadRepository + Store, T: Cob + Evaluate<R> + 'a, <T as Cob>::Action: Serialize,

Source

pub fn get(&self, id: &ObjectId) -> Result<Option<T>, Error>

Get an object.

Source

pub fn all(&self) -> Result<impl ExactSizeIterator + 'a, Error>

Return all objects.

Source

pub fn is_empty(&self) -> Result<bool, Error>

Return true if the list of issues is empty.

Source

pub fn count(&self) -> Result<usize, Error>

Return objects count.

Trait Implementations§

Source§

impl<T, R> AsRef<R> for Store<'_, T, R>

Source§

fn as_ref(&self) -> &R

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

§

impl<'a, T, R> Freeze for Store<'a, T, R>

§

impl<'a, T, R> RefUnwindSafe for Store<'a, T, R>

§

impl<'a, T, R> Send for Store<'a, T, R>
where R: Sync, T: Send,

§

impl<'a, T, R> Sync for Store<'a, T, R>
where R: Sync, T: Sync,

§

impl<'a, T, R> Unpin for Store<'a, T, R>
where T: Unpin,

§

impl<'a, T, R> UnwindSafe for Store<'a, T, R>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<T> IntoInit<ZeroInit> for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

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