pub struct MiiSelector { /* private fields */ }
Expand description

Configuration structure to setup the Mii Selector applet.

Implementations§

source§

impl MiiSelector

source

pub fn new() -> Self

Initialize a new configuration for the Mii Selector applet.

source

pub fn set_title(&mut self, text: &str)

Set the title of the Mii Selector window.

§Panics

This function will panic if the given &str contains NUL bytes.

§Example
use ctru::applets::mii_selector::MiiSelector;

let mut mii_selector = MiiSelector::new();
mii_selector.set_title("Select a Mii!");
source

pub fn set_options(&mut self, options: Options)

Set the options of the Mii Selector.

This will overwrite any previously saved options. Use bitwise operations to set all your wanted options at once.

§Example
use ctru::applets::mii_selector::{MiiSelector, Options};
let mut mii_selector = MiiSelector::new();

// Setup a `MiiSelector` that can be cancelled and that makes Guest Miis available to select.
let opts = Options::ENABLE_CANCEL & Options::ENABLE_GUESTS;
mii_selector.set_options(opts);
source

pub fn allowlist_guest_mii(&mut self, mii_index: Index)

Allowlist a guest Mii based on its index.

§Notes

Guest Mii’s won’t be available regardless of their allowlist/blocklist state if the MiiSelector is run without setting Options::ENABLE_GUESTS. Look into MiiSelector::set_options() to see how to work with options.

§Example
use ctru::applets::mii_selector::{Index, MiiSelector};
let mut mii_selector = MiiSelector::new();

// Allowlist the guest Mii at index 2.
mii_selector.allowlist_guest_mii(Index::Index(2));
source

pub fn blocklist_guest_mii(&mut self, mii_index: Index)

Blocklist a guest Mii based on its index.

§Notes

Guest Mii’s won’t be available regardless of their allowlist/blocklist state if the MiiSelector is run without setting Options::ENABLE_GUESTS. Look into MiiSelector::set_options() to see how to work with options.

§Example
use ctru::applets::mii_selector::{Index, MiiSelector};
let mut mii_selector = MiiSelector::new();

// Blocklist the guest Mii at index 1 so that it cannot be selected.
mii_selector.blocklist_guest_mii(Index::Index(1));
source

pub fn allowlist_user_mii(&mut self, mii_index: Index)

Allowlist a user-created Mii based on its index.

§Example
use ctru::applets::mii_selector::{Index, MiiSelector};
let mut mii_selector = MiiSelector::new();

// Allowlist the user-created Mii at index 0.
mii_selector.allowlist_user_mii(Index::Index(0));
source

pub fn blocklist_user_mii(&mut self, mii_index: Index)

Blocklist a user-created Mii based on its index.

§Example
use ctru::applets::mii_selector::{Index, MiiSelector};
let mut mii_selector = MiiSelector::new();

// Blocklist all user-created Miis so that they cannot be selected.
mii_selector.blocklist_user_mii(Index::All);
source

pub fn set_initial_index(&mut self, index: usize)

Set where the GUI cursor will start at.

If there’s no Mii at that index, the cursor will start at the Mii with the index 0.

source

pub fn launch(&mut self, _apt: &Apt, _gfx: &Gfx) -> Result<Selection, Error>

Launch the Mii Selector.

Depending on the configuration, the Mii Selector window will appear either on the bottom screen (default behaviour) or the top screen (see Options::USE_TOP_SCREEN).

§Example
use ctru::applets::mii_selector::{MiiSelector, Options};

let mut mii_selector = MiiSelector::new();
mii_selector.set_title("Select a Mii!");

let opts = Options::ENABLE_CANCEL & Options::ENABLE_GUESTS;
mii_selector.set_options(opts);

let result = mii_selector.launch(&apt, &gfx)?;

Trait Implementations§

source§

impl Clone for MiiSelector

source§

fn clone(&self) -> MiiSelector

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
source§

impl Debug for MiiSelector

source§

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

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

impl Default for MiiSelector

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for MiiSelector

§

impl Send for MiiSelector

§

impl Sync for MiiSelector

§

impl Unpin for MiiSelector

§

impl UnwindSafe for MiiSelector

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.