pub enum Many<T> {
Data(Vec<T>),
NotFetched,
None,
}Expand description
Enum for defining one-to-many or many-to-many relationships
Variants§
Data(Vec<T>)
This holds the created/fetched data in a vector
NotFetched
For when the data exists but is not fetched
None
For when you have no data to fill or fetch from the DB
Implementations§
Source§impl<T> Many<T>
impl<T> Many<T>
Sourcepub fn data(&self) -> Result<&Vec<T>, Error>
pub fn data(&self) -> Result<&Vec<T>, Error>
Returns the Vec of data if they exist and were fetched/created
Sourcepub fn data_mut(&mut self) -> Result<&mut Vec<T>, Error>
pub fn data_mut(&mut self) -> Result<&mut Vec<T>, Error>
Returns the mutable Vec of data if they exist and were fetched/created
Sourcepub fn is_not_fetched(&self) -> bool
pub fn is_not_fetched(&self) -> bool
Is this a NotFetched variant?
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Many<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Many<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Many<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Many<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T> Eq for Many<T>where
T: Eq,
Source§impl<T> Serialize for Many<T>where
T: Serialize,
impl<T> Serialize for Many<T>where
T: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> StructuralPartialEq for Many<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Freeze for Many<T>
impl<T> RefUnwindSafe for Many<T>where
T: RefUnwindSafe,
impl<T> Send for Many<T>where
T: Send,
impl<T> Sync for Many<T>where
T: Sync,
impl<T> Unpin for Many<T>where
T: Unpin,
impl<T> UnsafeUnpin for Many<T>
impl<T> UnwindSafe for Many<T>where
T: UnwindSafe,
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