pub struct DbQuestion {
pub id: u32,
pub title: String,
pub title_slug: String,
pub difficulty: String,
pub paid_only: bool,
pub status: Option<String>,
pub topics: Vec<DbTopic>,
}
Fields§
§id: u32
§title: String
§title_slug: String
§difficulty: String
§paid_only: bool
§status: Option<String>
§topics: Vec<DbTopic>
Implementations§
Source§impl DbQuestion
impl DbQuestion
Source§impl DbQuestion
impl DbQuestion
pub fn new( id: u32, title: &str, title_slug: &str, difficulty: String, paid_only: bool, status: Option<String>, ) -> Self
pub fn mark_accepted<'a>(&mut self) -> DBResult<Option<Vec<Self>>>
pub fn mark_attempted<'a>(&mut self) -> DBResult<Option<Vec<Self>>>
pub fn get_total_questions<'a>() -> DBResult<usize>
pub fn get_question_by_id<'a>(id: u32) -> DBResult<Self>
pub fn save_to_db<'a>(&mut self) -> DBResult<bool>
Trait Implementations§
Source§impl Clone for DbQuestion
impl Clone for DbQuestion
Source§fn clone(&self) -> DbQuestion
fn clone(&self) -> DbQuestion
Returns a copy 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 Debug for DbQuestion
impl Debug for DbQuestion
Source§impl<'de> Deserialize<'de> for DbQuestion
impl<'de> Deserialize<'de> for DbQuestion
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
Source§impl Display for DbQuestion
impl Display for DbQuestion
Source§impl Input for DbQuestion
impl Input for DbQuestion
fn native_db_bincode_encode_to_vec(&self) -> Vec<u8>
fn native_db_bincode_decode_from_slice(slice: &[u8]) -> Self
fn native_db_model() -> DatabaseModel
fn native_db_primary_key(&self) -> DatabaseInnerKeyValue
fn native_db_secondary_keys( &self, ) -> HashMap<DatabaseKeyDefinition<DatabaseSecondaryKeyOptions>, DatabaseKeyValue>
fn to_item(&self) -> DatabaseInput
Source§impl Model for DbQuestion
impl Model for DbQuestion
fn native_model_id() -> u32
fn native_model_id_str() -> &'static str
fn native_model_version() -> u32
fn native_model_version_str() -> &'static str
fn native_model_encode_body(&self) -> Result<Vec<u8>, EncodeBodyError>
fn native_model_encode_downgrade_body(self, version: u32) -> Result<Vec<u8>>
fn native_model_decode_body( data: Vec<u8>, id: u32, ) -> Result<Self, DecodeBodyError>
fn native_model_decode_upgrade_body( data: Vec<u8>, id: u32, version: u32, ) -> Result<Self>
fn native_model_decode(data: Vec<u8>) -> Result<(Self, u32), Error>where
Self: Sized,
fn native_model_encode(&self) -> Result<Vec<u8>, Error>where
Self: Sized,
fn native_model_encode_downgrade(self, version: u32) -> Result<Vec<u8>, Error>where
Self: Sized,
Source§impl PartialEq for DbQuestion
impl PartialEq for DbQuestion
Source§impl Serialize for DbQuestion
impl Serialize for DbQuestion
Source§impl TryFrom<Question> for DbQuestion
impl TryFrom<Question> for DbQuestion
impl StructuralPartialEq for DbQuestion
Auto Trait Implementations§
impl Freeze for DbQuestion
impl RefUnwindSafe for DbQuestion
impl Send for DbQuestion
impl Sync for DbQuestion
impl Unpin for DbQuestion
impl UnwindSafe for DbQuestion
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