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>>
pub fn data(&self) -> Result<&Vec<T>>
Returns the Vec of data if they exist and were fetched/created
Sourcepub fn data_mut(&mut self) -> Result<&mut Vec<T>>
pub fn data_mut(&mut self) -> Result<&mut Vec<T>>
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<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
impl<T: Eq> Eq for Many<T>
impl<T> StructuralPartialEq for Many<T>
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> 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