Skip to main content

Player

Struct Player 

Source
pub struct Player {
Show 24 fields pub id: String, pub name: String, pub surname: String, pub bio: String, pub pronouns: String, pub alias: String, pub niu: String, pub email: String, pub phone: String, pub faculty: String, pub isuab: bool, pub how_did_you_hear_about_us: String, pub social_media: Option<String>, pub password: String, pub player_number: i32, pub state: PlayerState, pub role: PlayerRole, pub birth_date: NaiveDate, pub accept_info_other_editions: bool, pub next_feeding: Option<CustomDateTime>, pub last_login: Option<NaiveDateTime>, pub checkpoint: Option<NaiveDateTime>, pub wants_to_be_zombie: i32, pub register_date: Option<NaiveDateTime>,
}
Expand description

Player struct

This is the main struct of the application.

It contains all the information about a player.

Fields§

§id: String§name: String§surname: String§bio: String§pronouns: String§alias: String§niu: String§email: String§phone: String§faculty: String§isuab: bool§how_did_you_hear_about_us: String§social_media: Option<String>§password: String§player_number: i32§state: PlayerState§role: PlayerRole§birth_date: NaiveDate§accept_info_other_editions: bool§next_feeding: Option<CustomDateTime>§last_login: Option<NaiveDateTime>§checkpoint: Option<NaiveDateTime>§wants_to_be_zombie: i32§register_date: Option<NaiveDateTime>

Implementations§

Source§

impl Player

Source

pub async fn recover_password( &self, username: String, password: String, ) -> Result<(), String>

Allows an admin to recover a player’s password.

§Arguments
  • username - The username of the player to recover the password for.
  • password - The new password to set for the player.
§Returns
  • Ok(()) if the password was successfully recovered.
  • Err(String) if an error occurred.
Source

pub async fn count_player(&self) -> Result<String, String>

Returns the number of players of each possible player state.

§Returns
  • Ok(String) if the count was successfully retrieved.
  • Err(String) if an error occurred.
Source

pub async fn admin_get_players(&self) -> Result<Vec<Player>, String>

Get all players for admins

§Returns
  • Ok(Vec<Player>) if the players were successfully retrieved.
  • Err(String) if an error occurred.
Source

pub async fn feed_players(&self, n: i32) -> Result<String, String>

Feeds a certain amount of players

§Arguments
  • n - The amount of players to feed.
§Returns
  • Ok(String) if the players were successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn admin_feed(&self, id: String) -> Result<String, String>

Feeds a single player.

§Arguments
  • id - The ID of the player to feed.
§Returns
  • Ok(String) if the player was successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn feed_zombies_day(&self) -> Result<String, String>

Adds a day to the zombies’ feeding time.

§Returns
  • Ok(String) if the zombies were successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn cure(&self, id: String) -> Result<String, String>

Cures a player.

§Arguments
  • id - The ID of the player to cure.
§Returns
  • Ok(String) if the player was successfully cured.
  • Err(String) if an error occurred.
Source

pub async fn transform( &self, alias: String, state: PlayerState, ) -> Result<String, String>

Transforms a player into a certain state.

§Arguments
  • alias - The alias of the player to transform.
  • state - The state to transform the player into.
§Returns
  • Ok(String) if the player was successfully transformed.
  • Err(String) if an error occurred.
Source

pub async fn set_checkpoint( &self, x: String, y: String, ) -> Result<String, String>

Sets the checkpoint coordinates.

§Arguments
  • coordinates - The coordinates to set as the checkpoint.
§Returns
  • Ok(String) if the checkpoint was successfully set.
  • Err(String) if an error occurred.
Source

pub async fn player_at_checkpoint( &self, player_id: String, ) -> Result<String, String>

Sets a player passing through the checkpoint

§Arguments
  • player_id (player that is at checkpoint)
§Returns
  • Ok(String) if the player was registered at the checkpoint successfully.
  • Err(String) if an error occurred.
Source

pub async fn kill_all_not_at_checkpoint(&self) -> Result<String, String>

Kills all players did not go through the checkpoint.

§Returns
  • Ok(String) if the players were killed successfully.
  • Err(String) if an error occurred.
Source

pub async fn inject_sql(&self, sql_command: String) -> Result<String, String>

Allows an admin to inject SQL commands.

§Arguments
  • sql_command - The SQL command to execute.
§Returns
  • Ok(String) if the SQL command was successfully executed.
  • Err(String) if an error occurred.
Source

pub async fn get_logs(&self) -> Result<String, String>

Retrieves the logs from the application.

§Returns
  • Ok(String) if the logs were successfully retrieved.
  • Err(String) if an error occurred.
Source§

impl Player

Implement Player struct

Source

pub async fn new( name: String, surname: String, pronouns: String, alias: String, niu: String, email: String, phone: String, faculty: String, isuab: bool, how_did_you_hear_about_us: String, social_media: Option<String>, password: String, birth_date: NaiveDate, accept_info_other_editions: bool, wants_to_be_zombie: i32, ) -> Self

Create a new player

§Arguments
  • name - The player’s name
  • surname - The player’s surname
  • pronouns - The player’s pronouns
  • alias - The player’s alias
  • niu - The player’s NIU
  • email - The player’s email
  • social_media - The player’s social media
  • phone - The player’s phone number
  • faculty - The player’s faculty
  • isuab - Whether the player is from UAB or not
  • how_did_you_hear_about_us - How the player heard about us
  • password - The player’s password
  • birth_date - The player’s birth date
§Returns

A new player instance

Source

fn get_next_player_number() -> i32

Get the next player number

This is used to assign a unique number to each player.

§Returns

The next player number

Source

pub async fn signup(&self) -> Result<Player, String>

Sign up a new player

Adds a new player to the database.

§Returns

The newly created player

Source

pub async fn login(username: &str, password: String) -> Result<Player, String>

Login a player

§Arguments
  • username - The username of the player
  • password - The password of the player
§Returns

The logged in player

Source

pub async fn logout(&self) -> Result<(), String>

Logs out a player

§Arguments
  • self - The player to log out
§Returns

The result of the logout operation

Source

pub async fn change_password( &self, old_password: String, new_password: String, ) -> Result<(), String>

Change the password of a player

§Arguments
  • old_password - The old password of the player
  • new_password - The new password of the player
§Returns

The result of the password change

Source

pub async fn edit( &self, bio: String, pronouns: String, alias: String, email: String, phone: String, social_media: Option<String>, accept_info_other_editions: bool, ) -> Result<(), String>

Edit player information.

§Arguments
  • pronouns - The player’s pronouns.
  • alias - The player’s alias.
  • email - The player’s email.
  • phone - The player’s phone number.
  • social_media - The player’s social media links.
  • accept_info_other_editions - Whether the player accepts information about other editions.
§Returns
  • Ok(()) if the player information was updated successfully.
  • Err(String) if there was an error updating the player information.
Source

pub async fn set_pfp(&self, payload: &mut Multipart) -> Result<String, String>

Set the profile picture of a player

§Arguments
  • field - The new profile picture of the player
§Returns
Source

pub async fn get_pfp(&self) -> Result<NamedFile, String>

Get the profile picture for a player

§Arguments
  • self - The player
§Returns

The profile picture for the player, or an error if it could not be opened

Source

pub async fn get_player(id: String) -> Result<Option<Player>, String>

Get a player by their ID

§Arguments
  • id - The ID of the player
§Returns

The player with the given ID, or None if no player was found

Source

pub async fn get_player_by_alias( alias: String, ) -> Result<Option<Player>, String>

Get a player by their alias

§Arguments
  • alias - The alias of the player
§Returns

The player with the given alias, or None if no player was found

Source

pub fn get_player_alias(id: String) -> Result<String, String>

Get the alias of a player

§Arguments
  • id - The ID of the player
§Returns

The alias of the player, or an error if the player was not found

Source

pub async fn get_all_players() -> Result<Vec<Player>, String>

Get all players

§Returns

A vector of all players, or an error if the query failed

Source

pub async fn get_checkpoint(&self) -> Result<(i32, i32), String>

Gets the checkpoints location

Method only available to human players.

§Returns

The location of the checkpoint

Source

pub async fn is_zombie(&self) -> bool

Check if a player is a zombie

This is checked from the PlayerState property.

§Returns

True if the player is a zombie, false otherwise

Source

pub async fn ensure_zombie(&self) -> Result<(), String>

Ensure that a player is a zombie

Acts as a guard for the zombie.rs module.

§Returns

Ok if the player is a zombie, Err otherwise

§Usage

This function is used to ensure that a player is a zombie before performing certain actions:

pub async fn zombie_func() {
    self.ensure_zombie().await?;
    // The rest of the function
}
Source

pub async fn ensure_human(&self) -> Result<(), String>

Ensure that a player is a human

Acts as a guard for the human-only functions.

§Returns

Ok if the player is a human, Err otherwise.

§Usage

This function is used to ensure that a player is a human before performing certain actions:

pub async fn human_func() {
    self.ensure_human().await?;
    // The rest of the function
}
Source

pub async fn is_admin(&self) -> bool

Check if the player is an admin

This is checked from the PlayerRole property.

§Returns

True if the player is an admin, false otherwise

Source

pub async fn ensure_admin(&self) -> Result<(), String>

Ensure that a player is an admin

Acts as a guard for the admin.rs module.

§Returns

Ok if the player is an admin, Err otherwise

§Usage

This function is used to ensure that a player is an admin before performing certain actions:

pub fn admin_func() {
    self.ensure_admin().await?;
    // The rest of the function
}
Source

pub async fn delete_player(id: String) -> Result<usize, String>

Delete a player by ID

§Arguments
  • id - The ID of the player to delete
§Returns

Ok if the player was deleted, Err otherwise

Source§

impl Player

Source

pub async fn get_next_feeding(&self) -> Result<Option<CustomDateTime>, String>

Calculates the next feeding time for a zombie player.

Returns None if the player is not a zombie.

§Errors

Returns an error if the player is not a zombie.

Source

pub async fn starvation( &self, ) -> Result<Vec<(String, Option<CustomDateTime>)>, String>

Gets the starvation status of all the zombies.

§Returns

A vector of tuples containing the player’s alias and their next feeding time.

§Errors

Returns an error if the player is not a zombie.

Source

pub async fn hunt( &self, target: &Player, feed1: Option<&Player>, feed2: Option<&Player>, ) -> Result<(), String>

Hunt a player and feed two other players.

§Arguments
  • target - The player to hunt.
  • feed1 - The first player to feed.
  • feed2 - The second player to feed.
§Errors

Returns an error if the player is not a zombie.

Source

pub async fn zombify(&self) -> Result<(), String>

Zombify a player

§Arguments
  • self - The player to zombify.
§Errors

Returns an error if the player is not a zombie.

Source

pub async fn feed( &self, amount: Option<i64>, ) -> Result<Option<CustomDateTime>, String>

Feed a player.

§Arguments
  • amount - The amount of time to feed the player in hours.
§Errors

Returns an error if the player is not a zombie.

Source

pub fn feeding_time_calc() -> Result<CustomDateTime, String>

Calculates the next feeding time for a zombie.

§Returns

The next feeding time as a NaiveDateTime.

Source

pub async fn monitor_zombie_death() -> !

Monitors the zombie death and updates the player state accordingly.

Every minute, it checks if the player’s next feeding time has passed. If so, it updates the player’s state to Corpse and sets the next feeding time to None.

§Errors

Returns an error if the player is not a zombie.

Trait Implementations§

Source§

impl Clone for Player

Source§

fn clone(&self) -> Player

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Player

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Player

Source§

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 Insertable<table> for Player
where String: AsExpression<<id as Expression>::SqlType> + AsExpression<<name as Expression>::SqlType> + AsExpression<<surname as Expression>::SqlType> + AsExpression<<bio as Expression>::SqlType> + AsExpression<<pronouns as Expression>::SqlType> + AsExpression<<alias as Expression>::SqlType> + AsExpression<<niu as Expression>::SqlType> + AsExpression<<email as Expression>::SqlType> + AsExpression<<phone as Expression>::SqlType> + AsExpression<<faculty as Expression>::SqlType> + AsExpression<<how_did_you_hear_about_us as Expression>::SqlType> + AsExpression<<social_media as Expression>::SqlType> + AsExpression<<password as Expression>::SqlType>, bool: AsExpression<<isuab as Expression>::SqlType> + AsExpression<<accept_info_other_editions as Expression>::SqlType>, i32: AsExpression<<player_number as Expression>::SqlType> + AsExpression<<wants_to_be_zombie as Expression>::SqlType>, PlayerState: AsExpression<<state as Expression>::SqlType>, PlayerRole: AsExpression<<role as Expression>::SqlType>, NaiveDate: AsExpression<<birth_date as Expression>::SqlType>, CustomDateTime: AsExpression<<next_feeding as Expression>::SqlType>, NaiveDateTime: AsExpression<<last_login as Expression>::SqlType> + AsExpression<<checkpoint as Expression>::SqlType> + AsExpression<<register_date as Expression>::SqlType>,

Source§

type Values = <(Option<Grouped<Eq<id, <String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<name, <String as AsExpression<<name as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<surname, <String as AsExpression<<surname as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<bio, <String as AsExpression<<bio as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<pronouns, <String as AsExpression<<pronouns as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<alias, <String as AsExpression<<alias as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<niu, <String as AsExpression<<niu as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<email, <String as AsExpression<<email as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<phone, <String as AsExpression<<phone as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<faculty, <String as AsExpression<<faculty as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<isuab, <bool as AsExpression<<isuab as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<how_did_you_hear_about_us, <String as AsExpression<<how_did_you_hear_about_us as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<social_media, <String as AsExpression<<social_media as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<password, <String as AsExpression<<password as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player_number, <i32 as AsExpression<<player_number as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<state, <PlayerState as AsExpression<<state as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<role, <PlayerRole as AsExpression<<role as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<birth_date, <NaiveDate as AsExpression<<birth_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<accept_info_other_editions, <bool as AsExpression<<accept_info_other_editions as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<next_feeding, <CustomDateTime as AsExpression<<next_feeding as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<last_login, <NaiveDateTime as AsExpression<<last_login as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<checkpoint, <NaiveDateTime as AsExpression<<checkpoint as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<wants_to_be_zombie, <i32 as AsExpression<<wants_to_be_zombie as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<register_date, <NaiveDateTime as AsExpression<<register_date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values

The VALUES clause to insert these records Read more
Source§

fn values( self, ) -> <(Option<Eq<id, String>>, Option<Eq<name, String>>, Option<Eq<surname, String>>, Option<Eq<bio, String>>, Option<Eq<pronouns, String>>, Option<Eq<alias, String>>, Option<Eq<niu, String>>, Option<Eq<email, String>>, Option<Eq<phone, String>>, Option<Eq<faculty, String>>, Option<Eq<isuab, bool>>, Option<Eq<how_did_you_hear_about_us, String>>, Option<Eq<social_media, String>>, Option<Eq<password, String>>, Option<Eq<player_number, i32>>, Option<Eq<state, PlayerState>>, Option<Eq<role, PlayerRole>>, Option<Eq<birth_date, NaiveDate>>, Option<Eq<accept_info_other_editions, bool>>, Option<Eq<next_feeding, CustomDateTime>>, Option<Eq<last_login, NaiveDateTime>>, Option<Eq<checkpoint, NaiveDateTime>>, Option<Eq<wants_to_be_zombie, i32>>, Option<Eq<register_date, NaiveDateTime>>) as Insertable<table>>::Values

Construct Self::Values Read more
§

fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
where T: Table, Self: Sized,

Insert self into a given table. Read more
Source§

impl<'insert> Insertable<table> for &'insert Player
where &'insert String: AsExpression<<id as Expression>::SqlType> + AsExpression<<name as Expression>::SqlType> + AsExpression<<surname as Expression>::SqlType> + AsExpression<<bio as Expression>::SqlType> + AsExpression<<pronouns as Expression>::SqlType> + AsExpression<<alias as Expression>::SqlType> + AsExpression<<niu as Expression>::SqlType> + AsExpression<<email as Expression>::SqlType> + AsExpression<<phone as Expression>::SqlType> + AsExpression<<faculty as Expression>::SqlType> + AsExpression<<how_did_you_hear_about_us as Expression>::SqlType> + AsExpression<<social_media as Expression>::SqlType> + AsExpression<<password as Expression>::SqlType>, &'insert bool: AsExpression<<isuab as Expression>::SqlType> + AsExpression<<accept_info_other_editions as Expression>::SqlType>, &'insert i32: AsExpression<<player_number as Expression>::SqlType> + AsExpression<<wants_to_be_zombie as Expression>::SqlType>, &'insert PlayerState: AsExpression<<state as Expression>::SqlType>, &'insert PlayerRole: AsExpression<<role as Expression>::SqlType>, &'insert NaiveDate: AsExpression<<birth_date as Expression>::SqlType>, &'insert CustomDateTime: AsExpression<<next_feeding as Expression>::SqlType>, &'insert NaiveDateTime: AsExpression<<last_login as Expression>::SqlType> + AsExpression<<checkpoint as Expression>::SqlType> + AsExpression<<register_date as Expression>::SqlType>,

Source§

type Values = <(Option<Grouped<Eq<id, <&'insert String as AsExpression<<id as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<name, <&'insert String as AsExpression<<name as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<surname, <&'insert String as AsExpression<<surname as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<bio, <&'insert String as AsExpression<<bio as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<pronouns, <&'insert String as AsExpression<<pronouns as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<alias, <&'insert String as AsExpression<<alias as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<niu, <&'insert String as AsExpression<<niu as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<email, <&'insert String as AsExpression<<email as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<phone, <&'insert String as AsExpression<<phone as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<faculty, <&'insert String as AsExpression<<faculty as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<isuab, <&'insert bool as AsExpression<<isuab as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<how_did_you_hear_about_us, <&'insert String as AsExpression<<how_did_you_hear_about_us as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<social_media, <&'insert String as AsExpression<<social_media as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<password, <&'insert String as AsExpression<<password as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<player_number, <&'insert i32 as AsExpression<<player_number as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<state, <&'insert PlayerState as AsExpression<<state as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<role, <&'insert PlayerRole as AsExpression<<role as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<birth_date, <&'insert NaiveDate as AsExpression<<birth_date as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<accept_info_other_editions, <&'insert bool as AsExpression<<accept_info_other_editions as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<next_feeding, <&'insert CustomDateTime as AsExpression<<next_feeding as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<last_login, <&'insert NaiveDateTime as AsExpression<<last_login as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<checkpoint, <&'insert NaiveDateTime as AsExpression<<checkpoint as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<wants_to_be_zombie, <&'insert i32 as AsExpression<<wants_to_be_zombie as Expression>::SqlType>>::Expression>>>, Option<Grouped<Eq<register_date, <&'insert NaiveDateTime as AsExpression<<register_date as Expression>::SqlType>>::Expression>>>) as Insertable<table>>::Values

The VALUES clause to insert these records Read more
Source§

fn values( self, ) -> <(Option<Eq<id, &'insert String>>, Option<Eq<name, &'insert String>>, Option<Eq<surname, &'insert String>>, Option<Eq<bio, &'insert String>>, Option<Eq<pronouns, &'insert String>>, Option<Eq<alias, &'insert String>>, Option<Eq<niu, &'insert String>>, Option<Eq<email, &'insert String>>, Option<Eq<phone, &'insert String>>, Option<Eq<faculty, &'insert String>>, Option<Eq<isuab, &'insert bool>>, Option<Eq<how_did_you_hear_about_us, &'insert String>>, Option<Eq<social_media, &'insert String>>, Option<Eq<password, &'insert String>>, Option<Eq<player_number, &'insert i32>>, Option<Eq<state, &'insert PlayerState>>, Option<Eq<role, &'insert PlayerRole>>, Option<Eq<birth_date, &'insert NaiveDate>>, Option<Eq<accept_info_other_editions, &'insert bool>>, Option<Eq<next_feeding, &'insert CustomDateTime>>, Option<Eq<last_login, &'insert NaiveDateTime>>, Option<Eq<checkpoint, &'insert NaiveDateTime>>, Option<Eq<wants_to_be_zombie, &'insert i32>>, Option<Eq<register_date, &'insert NaiveDateTime>>) as Insertable<table>>::Values

Construct Self::Values Read more
§

fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
where T: Table, Self: Sized,

Insert self into a given table. Read more
Source§

impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17, __ST18, __ST19, __ST20, __ST21, __ST22, __ST23> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5, __ST6, __ST7, __ST8, __ST9, __ST10, __ST11, __ST12, __ST13, __ST14, __ST15, __ST16, __ST17, __ST18, __ST19, __ST20, __ST21, __ST22, __ST23), __DB> for Player

Source§

impl<__DB: Backend> QueryableByName<__DB> for Player
where String: FromSql<SqlTypeOf<id>, __DB> + FromSql<SqlTypeOf<name>, __DB> + FromSql<SqlTypeOf<surname>, __DB> + FromSql<SqlTypeOf<bio>, __DB> + FromSql<SqlTypeOf<pronouns>, __DB> + FromSql<SqlTypeOf<alias>, __DB> + FromSql<SqlTypeOf<niu>, __DB> + FromSql<SqlTypeOf<email>, __DB> + FromSql<SqlTypeOf<phone>, __DB> + FromSql<SqlTypeOf<faculty>, __DB> + FromSql<SqlTypeOf<how_did_you_hear_about_us>, __DB> + FromSql<SqlTypeOf<password>, __DB>, bool: FromSql<SqlTypeOf<isuab>, __DB> + FromSql<SqlTypeOf<accept_info_other_editions>, __DB>, Option<String>: FromSql<SqlTypeOf<social_media>, __DB>, i32: FromSql<SqlTypeOf<player_number>, __DB> + FromSql<SqlTypeOf<wants_to_be_zombie>, __DB>, PlayerState: FromSql<SqlTypeOf<state>, __DB>, PlayerRole: FromSql<SqlTypeOf<role>, __DB>, NaiveDate: FromSql<SqlTypeOf<birth_date>, __DB>, Option<CustomDateTime>: FromSql<SqlTypeOf<next_feeding>, __DB>, Option<NaiveDateTime>: FromSql<SqlTypeOf<last_login>, __DB> + FromSql<SqlTypeOf<checkpoint>, __DB> + FromSql<SqlTypeOf<register_date>, __DB>,

Source§

fn build<'__a>(row: &impl NamedRow<'__a, __DB>) -> Result<Self>

Construct an instance of Self from the database row
Source§

impl<__DB: Backend> Selectable<__DB> for Player

Source§

impl Serialize for Player

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl UndecoratedInsertRecord<table> for Player

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AggregateExpressionMethods for T

§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneAny for T
where T: Any + Clone + Send + Sync,

§

fn clone_any(&self) -> Box<dyn CloneAny>

§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>

§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>

§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Send + Sync>

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<DB, T> FromSqlRow<Untyped, DB> for T
where DB: Backend, T: QueryableByName<DB>,

§

fn build_from_row<'a>( row: &impl Row<'a, DB>, ) -> Result<T, Box<dyn Error + Send + Sync>>

See the trait documentation.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expression
where Self: Sized + AsExpression<T>, T: SqlType + TypedExpressionType,

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>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, DB> SelectableHelper<DB> for T
where T: Selectable<DB>, DB: Backend,

§

fn as_select() -> SelectBy<T, DB>

Construct a select clause based on a [Selectable] implementation. Read more
§

fn as_returning() -> SelectBy<Self, DB>

An alias for as_select that can be used with returning clauses
§

impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
where ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,

§

const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE

The number of fields that this type will consume.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> UnsafeAny for T
where T: Any,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WindowExpressionMethods for T

§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more