pub struct Game { /* private fields */ }Expand description
§Game
Primary interface for all game operations.
The Game struct implements GameInterface and serves as the main entry point
for interacting with the game system. All game functionality is accessed
through this struct’s implementation.
Implementations§
Source§impl Game
impl Game
pub fn new( db_url: &str, config: Option<Arc<dyn ConfigInterface>>, ) -> GameResult<Self>
Trait Implementations§
Source§impl GameInterface for Game
impl GameInterface for Game
Source§fn item_find(&self, item_id: i32) -> GameResult<Arc<ItemData>>
fn item_find(&self, item_id: i32) -> GameResult<Arc<ItemData>>
Get ItemData for the specified item ID.
§Arguments
item_id: The ID of the item to get the data of. (See Config)
§Returns
Result<Arc<ItemData, Global>, errors::GameError>
- The ItemData, if an item with the given ID exists
- An error, if no item with the given id exists
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::item_data::ItemData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const ITEM_ID: i32 = 1;
const ITEM_NAME: &str = "Super Bad Rod";
// Define some item data
let item_data = ItemData {
name: ITEM_NAME.to_string(),
..Default::default()
};
let item_data_map = HashMap::from([(ITEM_ID, item_data)]);
// Add the location data to the config
let config = Config::builder().items(item_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Finding the item data
let found_item_data = game.item_find(ITEM_ID).unwrap();
assert_eq!(&found_item_data.name, ITEM_NAME);
// Searching for non-existent item data
let error = game.item_find(ITEM_ID + 1).unwrap_err();
assert!(error.is_not_found());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_item_not_found());
assert_eq!(resource_error.get_item_type_id(), Some(ITEM_ID + 1));
} else {
panic!("{:?}", error);
}Source§fn location_find(&self, location_id: i32) -> GameResult<Arc<LocationData>>
fn location_find(&self, location_id: i32) -> GameResult<Arc<LocationData>>
Get LocationData for the specified location ID.
§Arguments
location_id: The ID of the location to get the data of. (See Config)
§Returns
Result<Arc<LocationData, Global>, errors::GameError>
- The LocationData, if the location with the given ID exists
- An error, if no location with the given ID exists
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::game::prelude::*;
use fish_lib::data::location_data::LocationData;
use fish_lib::game::service_provider::ServiceProviderInterface;
const LOCATION_ID: i32 = 1;
const LOCATION_NAME: &str = "Central Europe";
// Define some location data
let location_data = LocationData {
name: LOCATION_NAME.to_string(),
..Default::default()
};
let location_data_map = HashMap::from([(LOCATION_ID, location_data)]);
// Add the location data to the config
let config = Config::builder().locations(location_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Finding the location data
let found_location_data = game.location_find(LOCATION_ID).unwrap();
assert_eq!(&found_location_data.name, LOCATION_NAME);
// Searching for non-existent location data
let error = game.location_find(LOCATION_ID + 1).unwrap_err();
assert!(error.is_not_found());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_location_not_found());
assert_eq!(resource_error.get_location_id(), Some(LOCATION_ID + 1));
} else {
panic!("{:?}", error);
}Source§fn location_weather_current(
&self,
location: Arc<LocationData>,
) -> GameResult<Weather>
fn location_weather_current( &self, location: Arc<LocationData>, ) -> GameResult<Weather>
Get the current Weather of a specified location. You will be able to get the weather for all locations specified by you in your Config.
§Arguments
§Returns
Result<Weather, errors::GameError>
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::location_data::LocationData;
use fish_lib::data::season_data::SeasonData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const LOCATION_ID: i32 = 1;
// For simplicity in testing, create a location with constant weather
let every_season = SeasonData {
min_temp_c: 10.0,
max_temp_c: 10.0,
..Default::default()
};
let location_data = LocationData {
spring: every_season.clone(),
summer: every_season.clone(),
autumn: every_season.clone(),
winter: every_season.clone(),
..Default::default()
};
let location_data_map = HashMap::from([(LOCATION_ID, location_data)]);
let config = Config::builder().locations(location_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Get the current weather
let location_data = game.location_find(LOCATION_ID).unwrap();
let weather = game.location_weather_current(location_data).unwrap();
assert_eq!(weather.temperature_c, 10.0);Source§fn species_find(&self, species_id: i32) -> GameResult<Arc<SpeciesData>>
fn species_find(&self, species_id: i32) -> GameResult<Arc<SpeciesData>>
Get SpeciesData for the specified species ID.
§Arguments
species_id: The ID of the species to get the data of. (See Config)
§Returns
Result<Arc<SpeciesData, Global>, errors::GameError>
- The SpeciesData, if the species with the given ID exists
- An error, if no species with the given ID exists
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::species_data::SpeciesData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const SPECIES_ID: i32 = 1;
const SPECIES_NAME: &str = "Salmon";
// Define some species data
let species_data = SpeciesData {
name: SPECIES_NAME.to_string(),
..Default::default()
};
let species_data_map = HashMap::from([(SPECIES_ID, species_data)]);
// Add the species data to the config
let config = Config::builder().species(species_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Finding the species data
let found_species_data = game.species_find(SPECIES_ID).unwrap();
assert_eq!(&found_species_data.name, SPECIES_NAME);
// Searching for non-existent species data
let error = game.species_find(SPECIES_ID + 1).unwrap_err();
assert!(error.is_not_found());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_species_not_found());
assert_eq!(resource_error.get_species_id(), Some(SPECIES_ID + 1));
} else {
panic!("{:?}", error);
}Source§fn user_catch_specific_specimen(
&self,
user: &User,
species: Arc<SpeciesData>,
) -> GameResult<(Specimen, FishingHistoryEntry)>
fn user_catch_specific_specimen( &self, user: &User, species: Arc<SpeciesData>, ) -> GameResult<(Specimen, FishingHistoryEntry)>
Generate a random Specimen of the given species ID and assign it to the given User.
§Arguments
user: The User for which the catch is to be registeredspecies_id: The species ID of the Specimen to be caught (See Config)
§Returns
Result<(Specimen, FishingHistoryEntry), errors::GameError>
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::species_data::SpeciesData;
use fish_lib::game::prelude::*;
use fish_lib::game::repositories::user_repository::UserRepository;
use fish_lib::game::service_provider::ServiceProviderInterface;
use fish_lib::models::user::User;
const USER_EXTERNAL_ID: i64 = 1337;
const SPECIES_ID: i32 = 1;
const SPECIES_NAME: &str = "Salmon";
// Define some species data
let species_data = SpeciesData {
name: SPECIES_NAME.to_string(),
..Default::default()
};
let species_data_map = HashMap::from([(SPECIES_ID, species_data)]);
// Add the species data to the config
let config = Config::builder().species(species_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Fetch the species data
let species = game.species_find(1).unwrap();
// Create a user
let user = game.user_register(USER_EXTERNAL_ID).unwrap();
// Let the user catch a specimen of the specified species ID
let (specimen, history_entry) = game.user_catch_specific_specimen(&user, species.clone()).unwrap();
assert_eq!(specimen.species_id, SPECIES_ID);
assert_eq!(specimen.user_id, user.id);
assert_eq!(history_entry.species_id, SPECIES_ID);
assert_eq!(history_entry.caught_count, 1);
// Catch a specimen for a user that doesn't exist
let dummy_user = User {
id: -1,
external_id: USER_EXTERNAL_ID + 1,
..Default::default()
};
let user_error = game.user_catch_specific_specimen(&dummy_user, species).unwrap_err();
if let Some(resource_error) = user_error.as_resource_error() {
assert!(resource_error.is_user_not_found());
assert_eq!(resource_error.get_external_id(), Some(USER_EXTERNAL_ID + 1));
} else {
panic!("{:?}", user_error);
}
Source§fn user_get_fishing_history(
&self,
user: &User,
species: Arc<SpeciesData>,
) -> GameResult<FishingHistoryEntry>
fn user_get_fishing_history( &self, user: &User, species: Arc<SpeciesData>, ) -> GameResult<FishingHistoryEntry>
Check the fishing history of a User with a specified species ID
§Arguments
user: The User to check the fishing history ofspecies_id: Fishing history species ID to check for the giving User (See Config)
§Returns
Result<FishingHistoryEntry, errors::GameError>
- The fishing history of the given User with a specified species, if it exists
- An error, if it does not exist, aka if the User did not catch that species yet or the User does not exist
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::species_data::SpeciesData;
use fish_lib::game::prelude::*;
use fish_lib::game::repositories::user_repository::UserRepository;
use fish_lib::game::service_provider::ServiceProviderInterface;
use fish_lib::models::user::User;
const USER_EXTERNAL_ID: i64 = 1337;
const SPECIES_ID: i32 = 1;
const SPECIES_NAME: &str = "Salmon";
// Define some species data
let species_data = SpeciesData {
name: SPECIES_NAME.to_string(),
..Default::default()
};
let species_data2 = SpeciesData {
..Default::default()
};
let species_data_map = HashMap::from([(SPECIES_ID, species_data), (SPECIES_ID + 1, species_data2)]);
// Add the species data to the config
let config = Config::builder().species(species_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Create a user
let user = game.user_register(USER_EXTERNAL_ID).unwrap();
// Get species data
let species = game.species_find(SPECIES_ID).unwrap();
let species2 = game.species_find(SPECIES_ID + 1).unwrap();
// Let the user catch a specimen
game.user_catch_specific_specimen(&user, species.clone()).unwrap();
// Fetch the fishing history of the user with the given species ID
let history_entry = game.user_get_fishing_history(&user, species.clone()).unwrap();
assert_eq!(history_entry.species_id, SPECIES_ID);
assert_eq!(history_entry.user_id, user.id);
assert_eq!(history_entry.caught_count, 1);
assert_eq!(history_entry.sold_count, 0);
// Trying to fetch the fishing history with a species the user didn't catch yet
let error = game.user_get_fishing_history(&user, species2).unwrap_err();
assert!(error.is_not_found());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_no_fishing_history());
assert_eq!(resource_error.get_external_id(), Some(USER_EXTERNAL_ID));
assert_eq!(resource_error.get_species_id(), Some(SPECIES_ID + 1));
} else {
panic!("{:?}", error);
}Source§fn user_find(&self, external_id: i64) -> GameResult<User>
fn user_find(&self, external_id: i64) -> GameResult<User>
Find a User by their external ID.
§Arguments
external_id: A freely selectable ID that your system will use to identify this User.
§Returns
Result<User, errors::GameError>
§Examples
use std::env;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, None).unwrap();
game.database().write().unwrap().clear().unwrap();
// Finding an existing user
let new_user = game.user_register(EXTERNAL_ID).unwrap();
let found_user = game.user_find(EXTERNAL_ID).unwrap();
assert_eq!(new_user, found_user);
// Searching for a non-existent user
let error = game.user_find(EXTERNAL_ID + 1).unwrap_err();
assert!(error.is_not_found());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_user_not_found());
assert_eq!(resource_error.get_external_id(), Some(EXTERNAL_ID + 1));
} else {
panic!("{:?}", error);
}Source§fn user_get_unlocked_locations(
&self,
user: &User,
) -> GameResult<Vec<UserLocationUnlock>>
fn user_get_unlocked_locations( &self, user: &User, ) -> GameResult<Vec<UserLocationUnlock>>
Fetch the unlocked locations of a given user.
§Arguments
user: The User to get the unlocked locations ([UserLocationUnlock]) from.
§Returns
Result<Vec<[UserLocationUnlock], Global>, errors::GameError>
- A vector with information about all location unlocks
- An error, if database operations fail
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::location_data::LocationData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
const LOCATION_ID: i32 = 13;
const LOCATION_NAME: &str = "Island";
// Define some location data
let location_data = LocationData {
name: LOCATION_NAME.to_string(),
..Default::default()
};
let location_data_map = HashMap::from([(LOCATION_ID, location_data)]);
// Add the location data to the config
let config = Config::builder().locations(location_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Registering a new user
let user = game.user_register(EXTERNAL_ID).unwrap();
// Let the user unlock a location
let island_location = game.location_find(LOCATION_ID).unwrap();
let unlocked_location = game.user_unlock_location(&user, island_location).unwrap();
// Get unlocked locations
let unlocked_locations = game.user_get_unlocked_locations(&user).unwrap();
assert_eq!(unlocked_locations.len(), 1);
assert_eq!(unlocked_locations[0], unlocked_location);Source§fn user_inventory(&self, user: &User) -> GameResult<Inventory>
fn user_inventory(&self, user: &User) -> GameResult<Inventory>
Get the [Inventory] of a specified User.
§Arguments
user: The User to get the [Inventory] from.
§Returns
Result<[Inventory], errors::GameError>
- The user’s inventory, if the user exists
- An error, if a database error occurred
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::item_data::ItemData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
const ITEM_ID: i32 = 1;
const ITEM_NAME: &str = "Super Bad Rod";
// Define some item data
let item_data = ItemData {
name: ITEM_NAME.to_string(),
..Default::default()
};
let item_data_map = HashMap::from([(ITEM_ID, item_data)]);
// Add the location data to the config
let config = Config::builder().items(item_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Registering a new user
let user = game.user_register(EXTERNAL_ID).unwrap();
assert_eq!(user.external_id, EXTERNAL_ID);
/// Giving the user an item
let item_data = game.item_find(ITEM_ID).unwrap();
let item = game.user_item_give(&user, item_data, 1).unwrap();
let inventory = game.user_inventory(&user).unwrap();
let items = inventory.get_items();
assert_eq!(items[0], item);
Source§fn user_item_give(
&self,
user: &User,
item_data: Arc<ItemData>,
count: u64,
) -> GameResult<Item>
fn user_item_give( &self, user: &User, item_data: Arc<ItemData>, count: u64, ) -> GameResult<Item>
Give a User a specified ItemData.
§Arguments
user: The User to give the item to.item_data: The ItemData to give the user. (See Config)count: How much of the item to give the user. 0 or 1 results in the default specified count if the item is stackable. If the item is not stackable (unique) it’ll be added once (no matter the specified count).
§Returns
Result<Item, errors::GameError>
- The newly created item when the operation was successful
- An error, if there was an error stacking the item or database operations failed
§Examples
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::item_data::ItemData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
const ITEM_ID: i32 = 1;
const ITEM_NAME: &str = "Super Bad Rod";
// Define some item data
let item_data = ItemData {
name: ITEM_NAME.to_string(),
..Default::default()
};
let item_data_map = HashMap::from([(ITEM_ID, item_data)]);
// Add the location data to the config
let config = Config::builder().items(item_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Registering a new user
let user = game.user_register(EXTERNAL_ID).unwrap();
assert_eq!(user.external_id, EXTERNAL_ID);
// Giving the user an item
let item_data = game.item_find(ITEM_ID).unwrap();
let item = game.user_item_give(&user, item_data, 1).unwrap();
let inventory = game.user_inventory(&user).unwrap();
let items = inventory.get_items();
assert_eq!(items[0], item);Source§fn user_register(&self, external_id: i64) -> GameResult<User>
fn user_register(&self, external_id: i64) -> GameResult<User>
Register a new User by their external ID.
§Arguments
external_id: A freely selectable ID that your system will use to identify this User.
§Returns
Result<User, errors::GameError>
- A newly created User with the given external id
- An error, if:
- A User with the given external id already exists
- Database operations fail
§Examples
use std::env;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, None).unwrap();
game.database().write().unwrap().clear().unwrap();
// Registering a new user
let user = game.user_register(EXTERNAL_ID).unwrap();
assert_eq!(user.external_id, EXTERNAL_ID);
// Registering an already existing user
let error = game.user_register(EXTERNAL_ID).unwrap_err();
assert!(error.is_already_exists());
if let Some(resource_error) = error.as_resource_error() {
assert!(resource_error.is_user_already_exists());
assert_eq!(resource_error.get_external_id(), Some(EXTERNAL_ID));
} else {
panic!("{:?}", error);
}Source§fn user_save(&self, user: User) -> GameResult<User>
fn user_save(&self, user: User) -> GameResult<User>
Save a User.
§Arguments
user: The User to save
§Returns
Result<User, errors::GameError>
- The updated User entity, if saving succeeded
- An error, if saving failed (database errors, or the user doesn’t exist)
§Examples
use std::env;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface; ///
use fish_lib::models::user::User;
const DUMMY_USER_ID: i64 = 64;
const USER_EXTERNAL_ID: i64 = 1337;
const USER_CREDITS: i64 = 293;
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, None).unwrap();
game.database().write().unwrap().clear().unwrap();
// Create a new user and update their credits
let mut user = game.user_register(USER_EXTERNAL_ID).unwrap();
user.credits = USER_CREDITS;
// Save the user and check if the credits were updated properly
let updated_user = game.user_save(user).unwrap();
assert_eq!(updated_user.credits, USER_CREDITS);
// Find user again and check if credits are updated properly
let found_user = game.user_find(USER_EXTERNAL_ID).unwrap();
assert_eq!(found_user.credits, USER_CREDITS);
// Try to save a non-existent user
let dummy_user = User {
id: DUMMY_USER_ID,
..Default::default()
};
let error_not_found = game.user_save(dummy_user).unwrap_err();
assert!(error_not_found.is_not_found())Source§fn user_unlock_location(
&self,
user: &User,
location: Arc<LocationData>,
) -> GameResult<UserLocationUnlock>
fn user_unlock_location( &self, user: &User, location: Arc<LocationData>, ) -> GameResult<UserLocationUnlock>
Unlocks a given location for a given user
§Arguments
§Returns
Result<[UserLocationUnlock], errors::GameError>
- Information about the location unlock, if it succeeded
- An error, if:
- unlock conditions were not met
- the location was already unlocked
- the location does not exist
- database operations fail
§Examples
use fish_lib::game::prelude::*;
use std::collections::HashMap;
use std::env;
use fish_lib::config::{Config, ConfigBuilderInterface};
use fish_lib::data::location_data::LocationData;
use fish_lib::game::prelude::*;
use fish_lib::game::service_provider::ServiceProviderInterface;
const EXTERNAL_ID: i64 = 1337;
const LOCATION_ID: i32 = 13;
const LOCATION_NAME: &str = "Island";
// Define some location data
let location_data = LocationData {
name: LOCATION_NAME.to_string(),
..Default::default()
};
let location_data2 = LocationData {
required_locations_unlocked: vec![LOCATION_ID + 2],
..Default::default()
};
let location_data3 = LocationData::default();
let location_data_map = HashMap::from([
(LOCATION_ID, location_data),
(LOCATION_ID + 1, location_data2),
(LOCATION_ID + 2, location_data3)
]);
// Add the location data to the config
let config = Config::builder().locations(location_data_map).build().unwrap();
// Create game and clear database for a blank test state
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let game = Game::new(&database_url, Some(config)).unwrap();
game.database().write().unwrap().clear().unwrap();
// Registering a new user
let user = game.user_register(EXTERNAL_ID).unwrap();
// Unlock a location for the user
let island = game.location_find(LOCATION_ID).unwrap();
let location_unlock = game.user_unlock_location(&user, island).unwrap();
// Find unlocked locations
let unlocked_locations = game.user_get_unlocked_locations(&user).unwrap();
assert_eq!(unlocked_locations.len(), 1);
assert_eq!(unlocked_locations[0], location_unlock);
// Unmet requirements
let location2 = game.location_find(LOCATION_ID + 1).unwrap();
let unlock_error = game.user_unlock_location(&user, location2).unwrap_err();
assert!(unlock_error.is_unmet_requirements());
if let Some(resource_error) = unlock_error.as_resource_error() {
assert!(resource_error.is_unmet_location_unlock_requirements());
assert_eq!(resource_error.get_location_id(), Some(LOCATION_ID + 1));
} else {
panic!("{:?}", unlock_error);
}Source§impl ServiceProviderInterface for Game
impl ServiceProviderInterface for Game
fn config(&self) -> Arc<dyn ConfigInterface>
fn database(&self) -> Arc<RwLock<dyn DatabaseInterface>>
fn fishing_history_entry_repository( &self, ) -> Arc<dyn FishingHistoryEntryRepositoryInterface>
fn item_repository(&self) -> Arc<dyn ItemRepositoryInterface>
fn pond_repository(&self) -> Arc<dyn PondRepositoryInterface>
fn specimen_repository(&self) -> Arc<dyn SpecimenRepositoryInterface>
fn user_repository(&self) -> Arc<dyn UserRepositoryInterface>
fn encounter_service(&self) -> Arc<dyn EncounterServiceInterface>
fn fishing_history_service(&self) -> Arc<dyn FishingHistoryServiceInterface>
fn item_service(&self) -> Arc<dyn ItemServiceInterface>
fn location_service(&self) -> Arc<dyn LocationServiceInterface>
fn pond_service(&self) -> Arc<dyn PondServiceInterface>
fn species_service(&self) -> Arc<dyn SpeciesServiceInterface>
fn specimen_service(&self) -> Arc<dyn SpecimenServiceInterface>
fn user_service(&self) -> Arc<dyn UserServiceInterface>
fn weather_service(&self) -> Arc<dyn WeatherServiceInterface>
Auto Trait Implementations§
impl Freeze for Game
impl !RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl !UnwindSafe for Game
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
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more