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>, DatabaseError>
Trait Implementations§
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 = Infallible
Source§fn tx_create(
cas_tx: &mut CompareAndSwapTransaction<Self::EntryDb>,
args: Self::CreateArgs,
) -> Result<Self, CustomTransactionError<Self::Err>>
fn tx_create( cas_tx: &mut CompareAndSwapTransaction<Self::EntryDb>, 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 EntryDb = 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) -> Result<bool, DatabaseError>
fn db_check(id: Self::Id) -> Result<bool, DatabaseError>
Checks if an item exists in the database as lightly as possible Read more
Source§fn db_get_from(
id: Self::Id,
db: &Self::EntryDb,
) -> Result<Option<Self>, DatabaseError>
fn db_get_from( id: Self::Id, db: &Self::EntryDb, ) -> Result<Option<Self>, DatabaseError>
Source§fn db_get_all_from(db: &Self::EntryDb) -> Result<Vec<Self>, DatabaseError>
fn db_get_all_from(db: &Self::EntryDb) -> Result<Vec<Self>, DatabaseError>
Source§fn db_get_all() -> Result<Vec<Self>, DatabaseError>
fn db_get_all() -> Result<Vec<Self>, DatabaseError>
Source§fn db_get_batch_from<I, A>(
ids: I,
db: &Self::EntryDb,
) -> Result<Vec<Self>, DatabaseError>
fn db_get_batch_from<I, A>( ids: I, db: &Self::EntryDb, ) -> Result<Vec<Self>, DatabaseError>
Source§fn db_get_batch<I, A>(ids: I) -> Result<Vec<Self>, DatabaseError>
fn db_get_batch<I, A>(ids: I) -> Result<Vec<Self>, DatabaseError>
Source§fn pre_upsert(
&mut self,
_cas_tx: &CompareAndSwapTransaction<Self::EntryDb>,
) -> Result<(), TransactionError>
fn pre_upsert( &mut self, _cas_tx: &CompareAndSwapTransaction<Self::EntryDb>, ) -> 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§fn db_upsert(&self) -> Result<(), TransactionError>
fn db_upsert(&self) -> Result<(), TransactionError>
Wrapper around
db_transaction() which upserts the item using CompareAndSwapTransaction::tx_upsert()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<EntryDb = LibraryDb>,
impl<T> EntryExtensions for Twhere
T: DatabaseEntry<EntryDb = LibraryDb>,
fn db_patch(self, db: Option<LibraryDb>) -> Result<(), TransactionError>where
T: Patchable<T>,
fn db_create(
args: <T as Createable>::CreateArgs,
) -> Result<T, CustomTransactionError<<T as Createable>::Err>>where
T: Createable,
fn db_merge(
&self,
into: <T as DatabaseEntry>::Id,
) -> Result<(), CustomTransactionError<<T as Mergeable>::Err>>where
T: Mergeable,
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