[−][src]Struct sudoku_backend::ops::SudokuSolution  
Refer to doc/sudoku.md for more details.
Fields
id: Option<i32>
                           Unique board ID.
Actually not optional, but this allows us to get an ID from the database.
display_name: String
                           Solver's display name
board_id: i32
                           The solved board ID
skeleton: String
                           The solved board skeleton
difficulty: i32
                           Board "difficulty", between one and three
solution_duration_secs: i32
                           Time in seconds taken to achieve the solution
score: i32
                           Score achieved for the solve
solution_time: NaiveDateTime
                           Time the solution occured at
Methods
impl SudokuSolution[src] 
impl SudokuSolutionpub fn new<Sn: Into<String>, Sk: Into<String>>(
    solver_name: Sn, 
    skeleton: Sk, 
    solved_board: &SudokuBoard, 
    solution_duration: &Duration
) -> Option<SudokuSolution>[src] 
pub fn new<Sn: Into<String>, Sk: Into<String>>(
    solver_name: Sn, 
    skeleton: Sk, 
    solved_board: &SudokuBoard, 
    solution_duration: &Duration
) -> Option<SudokuSolution>Create a ready-to-insert solution out of the specified data.
Does not validate.
pub fn leaders(
    cfg: &LeaderboardConfig, 
    db: &SqliteConnection
) -> Result<Vec<SudokuSolution>, &'static str>[src] 
pub fn leaders(
    cfg: &LeaderboardConfig, 
    db: &SqliteConnection
) -> Result<Vec<SudokuSolution>, &'static str>Retrieve the board with the specified ID.
Examples
Given:
INSERT INTO "sudoku_solutions"
    VALUES(1, 'benlo', 104,
           '.79.2.48...5..........3762.....4627....85......4.9....48....7..5......3.1.....9..',
           3, 26, 435, '2018-08-03 18:26:35');
INSERT INTO "sudoku_solutions"
    VALUES(2, 'EasyStudentBegonia', 104,
           '3.9..54..............937.2.9...4.27...6......21....56..8.56....5...1.8..1..3.....',
           3, 22, 498, '2018-08-03 18:42:56');
INSERT INTO "sudoku_solutions"
    VALUES(3, 'WithoutHighBirch', 104,
           '3.9..54.1.25.8.....4.9......581...7...68.....2....35...8....7.2.......3.1......54',
           3, 14, 732, '2018-08-03 18:44:06');
INSERT INTO "sudoku_solutions"
    VALUES(4, 'LateBrokenAppendix', 104,
           '.7...5..1...4.1...8....762.95......3..68.....21.............71....2......6.3..95.',
           3, 14, 732, '2018-08-03 18:44:25');
The following holds:
let solutions = SudokuSolution::leaders(&LeaderboardConfig { count: 3, ordering: SolutionOrdering::BestToWorst, }, &db).unwrap(); assert_eq!( solutions, &[SudokuSolution { id: Some(3), display_name: "WithoutHighBirch".to_string(), board_id: 104, skeleton: "3.9..54.1.25.8.....4.9......581...7...68.....2....35...8....7.2.......3.1......54".to_string(), difficulty: 3, solution_duration_secs: 14, score: 732, solution_time: NaiveDate::from_ymd(2018, 8, 3).and_hms(18, 44, 06), }, SudokuSolution { id: Some(4), display_name: "LateBrokenAppendix".to_string(), board_id: 104, skeleton: ".7...5..1...4.1...8....762.95......3..68.....21.............71....2......6.3..95.".to_string(), difficulty: 3, solution_duration_secs: 14, score: 732, solution_time: NaiveDate::from_ymd(2018, 8, 3).and_hms(18, 44, 25), }, SudokuSolution { id: Some(2), display_name: "EasyStudentBegonia".to_string(), board_id: 104, skeleton: "3.9..54..............937.2.9...4.27...6......21....56..8.56....5...1.8..1..3.....".to_string(), difficulty: 3, solution_duration_secs: 22, score: 498, solution_time: NaiveDate::from_ymd(2018, 8, 3).and_hms(18, 42, 56), }]);
pub fn insert(&mut self, db: &SqliteConnection) -> Result<(), &'static str>[src] 
pub fn insert(&mut self, db: &SqliteConnection) -> Result<(), &'static str>Insert this board into the specified DB, updating its id.
Examples
Assuming empty table:
let mut board = SudokuSolution::new(username, board_skeleton, &SudokuBoard::get(board_id, &db).unwrap(), Duration::seconds(25)); assert!(solution.id.is_none()); solution.insert(&db).unwrap(); assert_eq!(solution.id, Some(1));
Trait Implementations
impl PartialEq<SudokuSolution> for SudokuSolution[src] 
impl PartialEq<SudokuSolution> for SudokuSolutionfn eq(&self, other: &SudokuSolution) -> bool[src] 
fn eq(&self, other: &SudokuSolution) -> boolfn ne(&self, other: &SudokuSolution) -> bool[src] 
fn ne(&self, other: &SudokuSolution) -> boolimpl Clone for SudokuSolution[src] 
impl Clone for SudokuSolutionfn clone(&self) -> SudokuSolution[src] 
fn clone(&self) -> SudokuSolutionfn clone_from(&mut self, source: &Self)1.0.0[src] 
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Ord for SudokuSolution[src] 
impl Ord for SudokuSolutionfn cmp(&self, other: &SudokuSolution) -> Ordering[src] 
fn cmp(&self, other: &SudokuSolution) -> Orderingfn max(self, other: Self) -> Self1.21.0[src] 
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src] 
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl Eq for SudokuSolution[src] 
impl Eq for SudokuSolutionimpl PartialOrd<SudokuSolution> for SudokuSolution[src] 
impl PartialOrd<SudokuSolution> for SudokuSolutionfn partial_cmp(&self, other: &SudokuSolution) -> Option<Ordering>[src] 
fn partial_cmp(&self, other: &SudokuSolution) -> Option<Ordering>fn lt(&self, other: &SudokuSolution) -> bool[src] 
fn lt(&self, other: &SudokuSolution) -> boolfn le(&self, other: &SudokuSolution) -> bool[src] 
fn le(&self, other: &SudokuSolution) -> boolfn gt(&self, other: &SudokuSolution) -> bool[src] 
fn gt(&self, other: &SudokuSolution) -> boolfn ge(&self, other: &SudokuSolution) -> bool[src] 
fn ge(&self, other: &SudokuSolution) -> boolimpl Debug for SudokuSolution[src] 
impl Debug for SudokuSolutionimpl Hash for SudokuSolution[src] 
impl Hash for SudokuSolutionfn hash<__H: Hasher>(&self, state: &mut __H)[src] 
fn hash<__H: Hasher>(&self, state: &mut __H)fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, 1.3.0[src] 
fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl Serialize for SudokuSolution[src] 
impl Serialize for SudokuSolutionfn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer, [src] 
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer, impl<'de> Deserialize<'de> for SudokuSolution[src] 
impl<'de> Deserialize<'de> for SudokuSolutionfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, [src] 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, impl<'insert> Insertable<table> for SudokuSolution[src] 
impl<'insert> Insertable<table> for SudokuSolutiontype Values = <(Option<Eq<id, i32>>, Option<Eq<display_name, String>>, Option<Eq<board_id, i32>>, Option<Eq<skeleton, String>>, Option<Eq<difficulty, i32>>, Option<Eq<solution_duration_secs, i32>>, Option<Eq<score, i32>>, Option<Eq<solution_time, NaiveDateTime>>) as Insertable<table>>::Values
The VALUES clause to insert these records Read more
fn values(self) -> Self::Values[src] 
fn values(self) -> Self::Valuesfn insert_into(
    self, 
    table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>[src] 
fn insert_into(
    self, 
    table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>Insert self into a given table. Read more
impl<'insert> Insertable<table> for &'insert SudokuSolution[src] 
impl<'insert> Insertable<table> for &'insert SudokuSolutiontype Values = <(Option<Eq<id, &'insert i32>>, Option<Eq<display_name, &'insert String>>, Option<Eq<board_id, &'insert i32>>, Option<Eq<skeleton, &'insert String>>, Option<Eq<difficulty, &'insert i32>>, Option<Eq<solution_duration_secs, &'insert i32>>, Option<Eq<score, &'insert i32>>, Option<Eq<solution_time, &'insert NaiveDateTime>>) as Insertable<table>>::Values
The VALUES clause to insert these records Read more
fn values(self) -> Self::Values[src] 
fn values(self) -> Self::Valuesfn insert_into(
    self, 
    table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>[src] 
fn insert_into(
    self, 
    table: T
) -> InsertStatement<T, Self::Values, Insert, NoReturningClause>Insert self into a given table. Read more
impl<__DB: Backend, __ST> Queryable<__ST, __DB> for SudokuSolution where
    (Option<i32>, String, i32, String, i32, i32, i32, NaiveDateTime): Queryable<__ST, __DB>, [src] 
impl<__DB: Backend, __ST> Queryable<__ST, __DB> for SudokuSolution where
    (Option<i32>, String, i32, String, i32, i32, i32, NaiveDateTime): Queryable<__ST, __DB>, type Row = <(Option<i32>, String, i32, String, i32, i32, i32, NaiveDateTime) as Queryable<__ST, __DB>>::Row
The Rust type you'd like to map from. Read more
fn build(row: Self::Row) -> Self[src] 
fn build(row: Self::Row) -> Selfimpl<'update> AsChangeset for &'update SudokuSolution[src] 
impl<'update> AsChangeset for &'update SudokuSolutiontype Target = table
The table which Self::Changeset will be updating
type Changeset = <(Eq<display_name, &'update String>, Eq<board_id, &'update i32>, Eq<skeleton, &'update String>, Eq<difficulty, &'update i32>, Eq<solution_duration_secs, &'update i32>, Eq<score, &'update i32>, Eq<solution_time, &'update NaiveDateTime>) as AsChangeset>::Changeset
The update statement this type represents
fn as_changeset(self) -> Self::Changeset[src] 
fn as_changeset(self) -> Self::Changesetimpl<'update> AsChangeset for SudokuSolution[src] 
impl<'update> AsChangeset for SudokuSolutiontype Target = table
The table which Self::Changeset will be updating
type Changeset = <(Eq<display_name, String>, Eq<board_id, i32>, Eq<skeleton, String>, Eq<difficulty, i32>, Eq<solution_duration_secs, i32>, Eq<score, i32>, Eq<solution_time, NaiveDateTime>) as AsChangeset>::Changeset
The update statement this type represents
fn as_changeset(self) -> Self::Changeset[src] 
fn as_changeset(self) -> Self::Changesetimpl<'insert> UndecoratedInsertRecord<table> for SudokuSolution[src] 
impl<'insert> UndecoratedInsertRecord<table> for SudokuSolutionAuto Trait Implementations
impl Send for SudokuSolution
impl Send for SudokuSolutionimpl Sync for SudokuSolution
impl Sync for SudokuSolutionBlanket Implementations
impl<T> From for T[src] 
impl<T> From for Timpl<T, U> Into for T where
    U: From<T>, [src] 
impl<T, U> Into for T where
    U: From<T>, impl<T> ToOwned for T where
    T: Clone, [src] 
impl<T> ToOwned for T where
    T: Clone, impl<T, U> TryFrom for T where
    T: From<U>, [src] 
impl<T, U> TryFrom for T where
    T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src] 
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
    T: ?Sized, [src] 
impl<T> Borrow for T where
    T: ?Sized, impl<T> Any for T where
    T: 'static + ?Sized, [src] 
impl<T> Any for T where
    T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src] 
fn get_type_id(&self) -> TypeIdimpl<T, U> TryInto for T where
    U: TryFrom<T>, [src] 
impl<T, U> TryInto for T where
    U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src] 
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> BorrowMut for T where
    T: ?Sized, [src] 
impl<T> BorrowMut for T where
    T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src] 
fn borrow_mut(&mut self) -> &mut Timpl<T> DeserializeOwned for T where
    T: Deserialize<'de>, [src] 
impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, impl<T> Typeable for T where
    T: Any, [src] 
impl<T> Typeable for T where
    T: Any, impl<T> IntoSql for T[src] 
impl<T> IntoSql for Tfn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, [src] 
fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, Convert self to an expression for Diesel's query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, [src] 
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, Convert &self to an expression for Diesel's query builder. Read more