Update the rust doc

This commit is contained in:
Gwilym Kuiper 2022-01-16 21:48:45 +00:00
parent f3e3782699
commit 040ff2eb0c

View file

@ -114,7 +114,7 @@ pub use agb_image_converter::include_gfx;
/// This macro declares the entry point to your game written using `agb`. /// This macro declares the entry point to your game written using `agb`.
/// ///
/// It is already included in the template, but your `main` function must be annotated with `#[agb::entry]`, take no arguments and never return. /// It is already included in the template, but your `main` function must be annotated with `#[agb::entry]`, takes 1 argument and never returns.
/// Doing this will ensure that `agb` can correctly set up the environment to call your rust function on start up. /// Doing this will ensure that `agb` can correctly set up the environment to call your rust function on start up.
/// ///
/// # Examples /// # Examples
@ -125,9 +125,7 @@ pub use agb_image_converter::include_gfx;
/// use agb::Gba; /// use agb::Gba;
/// ///
/// #[agb::entry] /// #[agb::entry]
/// fn main() -> ! { /// fn main(mut gba: Gba) -> ! {
/// let mut gba = Gba::new();
///
/// loop {} /// loop {}
/// } /// }
/// ``` /// ```
@ -180,13 +178,7 @@ static mut GBASINGLE: single::Singleton<Gba> = single::Singleton::new(unsafe { G
/// The Gba struct is used to control access to the Game Boy Advance's hardware in a way which makes it the /// The Gba struct is used to control access to the Game Boy Advance's hardware in a way which makes it the
/// borrow checker's responsibility to ensure no clashes of global resources. /// borrow checker's responsibility to ensure no clashes of global resources.
/// ///
/// This is typically created once at the start of the main function and then the various fields are used /// This is will be created for you via the #[agb::entry] attribute.
/// to ensure mutually exclusive use of the various hardware registers. It provides a gateway into the main
/// usage of `agb` library.
///
/// # Panics
///
/// Calling this twice will panic.
/// ///
/// # Examples /// # Examples
/// ///
@ -197,9 +189,7 @@ static mut GBASINGLE: single::Singleton<Gba> = single::Singleton::new(unsafe { G
/// use agb::Gba; /// use agb::Gba;
/// ///
/// #[agb::entry] /// #[agb::entry]
/// fn main() -> ! { /// fn main(mut gba: Gba) -> !
/// let mut gba = Gba::new();
///
/// // Do whatever you need to do with gba /// // Do whatever you need to do with gba
/// ///
/// loop {} /// loop {}
@ -219,13 +209,7 @@ pub struct Gba {
} }
impl Gba { impl Gba {
/// Creates a new instance of the Gba struct. #[doc(hidden)]
///
/// Note that you can only create 1 instance, and trying to create a second will panic.
///
/// # Panics
///
/// Panics if you try to create the second instance.
pub fn new() -> Self { pub fn new() -> Self {
unsafe { GBASINGLE.take() } unsafe { GBASINGLE.take() }
} }