Browse Source

Add documentation to LaunchError. Update mii-selector example.

pull/122/head
DeltaF1 2 years ago
parent
commit
1e158191ff
  1. 2
      ctru-rs/examples/mii-selector.rs
  2. 3
      ctru-rs/src/applets/mii_selector.rs

2
ctru-rs/examples/mii-selector.rs

@ -10,13 +10,13 @@ fn main() {
let _console = Console::new(gfx.top_screen.borrow_mut()); let _console = Console::new(gfx.top_screen.borrow_mut());
let mut mii_selector = MiiSelector::new(); let mut mii_selector = MiiSelector::new();
mii_selector.set_options(Options::MII_SELECTOR_CANCEL);
mii_selector.set_initial_index(3); mii_selector.set_initial_index(3);
mii_selector.blacklist_user_mii(0.into()); mii_selector.blacklist_user_mii(0.into());
mii_selector.set_title("Great Mii Selector!"); mii_selector.set_title("Great Mii Selector!");
match mii_selector.launch() { match mii_selector.launch() {
Ok(result) => { Ok(result) => {
println!("Is Mii selected?: {:?}", result.is_mii_selected);
println!("Mii type: {:?}", result.mii_type); println!("Mii type: {:?}", result.mii_type);
println!("Name: {:?}", result.mii_data.name); println!("Name: {:?}", result.mii_data.name);
println!("Author: {:?}", result.mii_data.author_name); println!("Author: {:?}", result.mii_data.author_name);

3
ctru-rs/src/applets/mii_selector.rs

@ -65,7 +65,10 @@ pub struct SelectionResult {
/// Error type for the Mii selector /// Error type for the Mii selector
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum LaunchError { pub enum LaunchError {
/// The selected Mii's data is corrupt in some way
InvalidChecksum, InvalidChecksum,
/// Either the user cancelled the selection (see [Options::MII_SELECTOR_CANCEL]), or no valid Miis were available to select
NoMiiSelected, NoMiiSelected,
} }

Loading…
Cancel
Save