1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Provides traits necessary to implement or use a [`GameInterface`](super::GameInterface)
//!
//! # Examples
//! ```
//! use bfbb::game_interface::game_var::{GameVar, GameVarMut, InterfaceBackend};
//! use bfbb::game_interface::{GameInterface, InterfaceResult};
//!
//! fn do_thing<V: InterfaceBackend> (interface: &mut GameInterface<V>) -> InterfaceResult<()> {
//! // Here you can access game variables or perform actions on the interface.
//! interface.spatula_count.get()?;
//! interface.start_new_game()
//! }
//! ```
use CheckedBitPattern;
use crateEndianAware;
use InterfaceResult;
/// Allows accessing the value of a variable within BfBB
/// Allows mutating a variable within BfBB
/// A trait with type constructors for [`GameVar`]s that are generic over an implementation (backend).
///
/// For [`GameInterface`](super::GameInterface) implementations, this trait should be implemented on a marker struct
/// and provide its [`GameVar`] implementation to the type constructors. (See [`DolphinBackend`](crate::game_interface::dolphin::dolphin_var::DolphinBackend)).
///
/// For users, you will need to use this trait to write code that is generic over any `GameInterface` implementation.
///
/// # Examples
/// ```
/// use bfbb::game_interface::game_var::InterfaceBackend;
/// use bfbb::game_interface::GameInterface;
///
/// fn takes_generic<V: InterfaceBackend>(interface: &mut GameInterface<V>) {
/// todo!();
/// }
/// ```