pub struct Collection {
pub name: String,
pub cover_art: Option<ImageArt>,
pub items: CollectionType,
/* private fields */
}Fields§
§name: String§cover_art: Option<ImageArt>§items: CollectionTypeImplementations§
Source§impl Collection
impl Collection
pub fn db_find_by_name(
name: impl AsRef<str>,
) -> Result<Option<Self>, DatabaseError>where
Self: 'static,
Source§impl Collection
impl Collection
pub fn collectables( &self, db: &LibraryDb, ) -> Result<Vec<Collectable>, TransactionError>
Trait Implementations§
Source§impl Cacheable for Collection
impl Cacheable for Collection
fn cache() -> &'static Mutex<DbCache<Self>>
fn cache_get( id: Self::Id, db: &Self::Db, ) -> Result<Option<Arc<Self>>, TransactionError>
fn cache_get_batch<I>(
ids: I,
db: &Self::Db,
) -> Result<Vec<Arc<Self>>, TransactionError>where
I: IntoIterator<Item = Self::Id>,
fn cache_get_all_from(db: &Self::Db) -> Result<Vec<Arc<Self>>, TransactionError>
Source§impl Clone for Collection
impl Clone for Collection
Source§fn clone(&self) -> Collection
fn clone(&self) -> Collection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Createable for Collection
impl Createable for Collection
type CreateArgs = CollectionCreateArgs
type Err = CollectionCreationError
Source§fn tx_create(
cas_tx: &mut CompareAndSwapTransaction<Self::Db>,
args: Self::CreateArgs,
) -> Result<Self, CustomTransactionError<Self::Err>>
fn tx_create( cas_tx: &mut CompareAndSwapTransaction<Self::Db>, args: Self::CreateArgs, ) -> Result<Self, CustomTransactionError<Self::Err>>
Creates a new
Self in the database using Self::CreateArgsSource§impl DatabaseEntry for Collection
impl DatabaseEntry for Collection
Source§const VERSION_NUMBER: u32 = 1
const VERSION_NUMBER: u32 = 1
The current version number of the struct, used for updating
type Id = CollectionId
type Db = LibraryDb
Source§fn read_only(&self) -> bool
fn read_only(&self) -> bool
This function is called before a value is upserted, if it returns true, an error will be returned from the transaction. Read more
Source§fn db_check(id: Self::Id, db: &Self::Db) -> Result<bool, TransactionError>
fn db_check(id: Self::Id, db: &Self::Db) -> Result<bool, TransactionError>
Checks if an item exists in the database as lightly as possible Read more
Source§fn db_get_all(db: &Self::Db) -> Result<Vec<Self>, TransactionError>
fn db_get_all(db: &Self::Db) -> Result<Vec<Self>, TransactionError>
Source§fn db_get_batch<I>(ids: I, db: &Self::Db) -> Result<Vec<Self>, TransactionError>where
I: IntoIterator<Item = Self::Id>,
fn db_get_batch<I>(ids: I, db: &Self::Db) -> Result<Vec<Self>, TransactionError>where
I: IntoIterator<Item = Self::Id>,
Source§fn pre_upsert(
&mut self,
_cas_tx: &CompareAndSwapTransaction<Self::Db>,
) -> Result<(), TransactionError>
fn pre_upsert( &mut self, _cas_tx: &CompareAndSwapTransaction<Self::Db>, ) -> Result<(), TransactionError>
This function is called before a value is upserted, allowing you to make last moment changes before its upserted into the database, like field sorting
Source§impl Debug for Collection
impl Debug for Collection
Source§impl<'de> Deserialize<'de> for Collection
impl<'de> Deserialize<'de> for Collection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Collection
impl RefUnwindSafe for Collection
impl Send for Collection
impl Sync for Collection
impl Unpin for Collection
impl UnsafeUnpin for Collection
impl UnwindSafe for Collection
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EntryExtensions for Twhere
T: DatabaseEntry,
impl<T> EntryExtensions for Twhere
T: DatabaseEntry,
Source§fn db_upsert(self, db: DbHandle<Self::Db>) -> Result<(), TransactionError>
fn db_upsert(self, db: DbHandle<Self::Db>) -> Result<(), TransactionError>
Upserts an entry from the database Read more
Source§fn db_insert(self, db: DbHandle<Self::Db>) -> Result<(), TransactionError>
fn db_insert(self, db: DbHandle<Self::Db>) -> Result<(), TransactionError>
Inserts an entry from the database Read more
fn db_merge(
self,
from: Self,
db: DbHandle<Self::Db>,
) -> Result<Self, TransactionError>where
Self: Mergeable,
Source§fn db_patch(self, db: DbHandle<Self::Db>) -> Result<Self, TransactionError>where
Self: Mergeable,
fn db_patch(self, db: DbHandle<Self::Db>) -> Result<Self, TransactionError>where
Self: Mergeable,
Attempts to merge the input entry into the existing entry. Upserts if the entry is not found Read more
fn db_merge_batch(
self,
from: impl IntoIterator<Item = Self> + Clone,
db: DbHandle<Self::Db>,
) -> Result<Self, TransactionError>where
Self: Mergeable,
fn db_delete(
&mut self,
item: Self,
db: DbHandle<Self::Db>,
) -> Result<(), TransactionError>where
Self: Deleteable,
fn db_delete_id<Id>(
id: Self::Id,
db: DbHandle<Self::Db>,
) -> Result<(), TransactionError>where
Self: Deleteable,
fn db_create(
args: Self::CreateArgs,
db: DbHandle<Self::Db>,
) -> Result<Self, CustomTransactionError<Self::Err>>where
Self: Createable,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
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 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>
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