Browse Source

Rename functions to allowlist/blocklist

pull/137/head
Andrea Ciliberti 1 year ago
parent
commit
18924dfcf4
  1. 2
      ctru-rs/examples/mii-selector.rs
  2. 38
      ctru-rs/src/applets/mii_selector.rs

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

@ -19,7 +19,7 @@ fn main() {
mii_selector.set_options(Options::ENABLE_CANCEL); mii_selector.set_options(Options::ENABLE_CANCEL);
mii_selector.set_initial_index(3); mii_selector.set_initial_index(3);
// The first user-made Mii cannot be used. // The first user-made Mii cannot be used.
mii_selector.blacklist_user_mii(0.into()); mii_selector.blocklist_user_mii(0.into());
mii_selector.set_title("Great Mii Selector!"); mii_selector.set_title("Great Mii Selector!");
// Launch the Mii Selector and use its result to print the selected Mii's information. // Launch the Mii Selector and use its result to print the selected Mii's information.

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

@ -9,7 +9,7 @@ use std::{ffi::CString, fmt};
/// Index of a Mii on the [`MiiSelector`] interface. /// Index of a Mii on the [`MiiSelector`] interface.
/// ///
/// See [`MiiSelector::whitelist_user_mii()`] and related functions for more information. /// See [`MiiSelector::allowlist_user_mii()`] and related functions for more information.
#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Index { pub enum Index {
/// Specific Mii index. /// Specific Mii index.
@ -136,11 +136,11 @@ impl MiiSelector {
unsafe { ctru_sys::miiSelectorSetOptions(self.config.as_mut(), options.bits()) } unsafe { ctru_sys::miiSelectorSetOptions(self.config.as_mut(), options.bits()) }
} }
/// Whitelist a guest Mii based on its index. /// Allowlist a guest Mii based on its index.
/// ///
/// # Notes /// # Notes
/// ///
/// Guest Mii's won't be available regardless of their whitelist/blacklist state if the [`MiiSelector`] is run without setting [`Options::ENABLE_GUESTS`]. /// 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. /// Look into [`MiiSelector::set_options()`] to see how to work with options.
/// ///
/// # Example /// # Example
@ -151,12 +151,12 @@ impl MiiSelector {
/// use ctru::applets::mii_selector::{Index, MiiSelector}; /// use ctru::applets::mii_selector::{Index, MiiSelector};
/// let mut mii_selector = MiiSelector::new(); /// let mut mii_selector = MiiSelector::new();
/// ///
/// // Whitelist the guest Mii at index 2. /// // Allowlist the guest Mii at index 2.
/// mii_selector.whitelist_guest_mii(Index::Index(2)); /// mii_selector.allowlist_guest_mii(Index::Index(2));
/// # } /// # }
/// ``` /// ```
#[doc(alias = "miiSelectorWhitelistGuestMii")] #[doc(alias = "miiSelectorWhitelistGuestMii")]
pub fn whitelist_guest_mii(&mut self, mii_index: Index) { pub fn allowlist_guest_mii(&mut self, mii_index: Index) {
let index = match mii_index { let index = match mii_index {
Index::Index(i) => i, Index::Index(i) => i,
Index::All => ctru_sys::MIISELECTOR_GUESTMII_SLOTS, Index::All => ctru_sys::MIISELECTOR_GUESTMII_SLOTS,
@ -165,11 +165,11 @@ impl MiiSelector {
unsafe { ctru_sys::miiSelectorWhitelistGuestMii(self.config.as_mut(), index) } unsafe { ctru_sys::miiSelectorWhitelistGuestMii(self.config.as_mut(), index) }
} }
/// Blacklist a guest Mii based on its index. /// Blocklist a guest Mii based on its index.
/// ///
/// # Notes /// # Notes
/// ///
/// Guest Mii's won't be available regardless of their whitelist/blacklist state if the [`MiiSelector`] is run without setting [`Options::ENABLE_GUESTS`]. /// 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. /// Look into [`MiiSelector::set_options()`] to see how to work with options.
/// ///
/// # Example /// # Example
@ -180,12 +180,12 @@ impl MiiSelector {
/// use ctru::applets::mii_selector::{Index, MiiSelector}; /// use ctru::applets::mii_selector::{Index, MiiSelector};
/// let mut mii_selector = MiiSelector::new(); /// let mut mii_selector = MiiSelector::new();
/// ///
/// // Blacklist the guest Mii at index 1 so that it cannot be selected. /// // Blocklist the guest Mii at index 1 so that it cannot be selected.
/// mii_selector.blacklist_guest_mii(Index::Index(1)); /// mii_selector.blocklist_guest_mii(Index::Index(1));
/// # } /// # }
/// ``` /// ```
#[doc(alias = "miiSelectorBlacklistGuestMii")] #[doc(alias = "miiSelectorBlacklistGuestMii")]
pub fn blacklist_guest_mii(&mut self, mii_index: Index) { pub fn blocklist_guest_mii(&mut self, mii_index: Index) {
let index = match mii_index { let index = match mii_index {
Index::Index(i) => i, Index::Index(i) => i,
Index::All => ctru_sys::MIISELECTOR_GUESTMII_SLOTS, Index::All => ctru_sys::MIISELECTOR_GUESTMII_SLOTS,
@ -194,7 +194,7 @@ impl MiiSelector {
unsafe { ctru_sys::miiSelectorBlacklistGuestMii(self.config.as_mut(), index) } unsafe { ctru_sys::miiSelectorBlacklistGuestMii(self.config.as_mut(), index) }
} }
/// Whitelist a user-created Mii based on its index. /// Allowlist a user-created Mii based on its index.
/// ///
/// # Example /// # Example
/// ///
@ -204,12 +204,12 @@ impl MiiSelector {
/// use ctru::applets::mii_selector::{Index, MiiSelector}; /// use ctru::applets::mii_selector::{Index, MiiSelector};
/// let mut mii_selector = MiiSelector::new(); /// let mut mii_selector = MiiSelector::new();
/// ///
/// // Whitelist the user-created Mii at index 0. /// // Allowlist the user-created Mii at index 0.
/// mii_selector.whitelist_user_mii(Index::Index(0)); /// mii_selector.allowlist_user_mii(Index::Index(0));
/// # } /// # }
/// ``` /// ```
#[doc(alias = "miiSelectorWhitelistUserMii")] #[doc(alias = "miiSelectorWhitelistUserMii")]
pub fn whitelist_user_mii(&mut self, mii_index: Index) { pub fn allowlist_user_mii(&mut self, mii_index: Index) {
let index = match mii_index { let index = match mii_index {
Index::Index(i) => i, Index::Index(i) => i,
Index::All => ctru_sys::MIISELECTOR_USERMII_SLOTS, Index::All => ctru_sys::MIISELECTOR_USERMII_SLOTS,
@ -218,7 +218,7 @@ impl MiiSelector {
unsafe { ctru_sys::miiSelectorWhitelistUserMii(self.config.as_mut(), index) } unsafe { ctru_sys::miiSelectorWhitelistUserMii(self.config.as_mut(), index) }
} }
/// Blacklist a user-created Mii based on its index. /// Blocklist a user-created Mii based on its index.
/// ///
/// # Example /// # Example
/// ///
@ -228,12 +228,12 @@ impl MiiSelector {
/// use ctru::applets::mii_selector::{Index, MiiSelector}; /// use ctru::applets::mii_selector::{Index, MiiSelector};
/// let mut mii_selector = MiiSelector::new(); /// let mut mii_selector = MiiSelector::new();
/// ///
/// // Blacklist all user-created Miis so that they cannot be selected. /// // Blocklist all user-created Miis so that they cannot be selected.
/// mii_selector.blacklist_user_mii(Index::All); /// mii_selector.blocklist_user_mii(Index::All);
/// # } /// # }
/// ``` /// ```
#[doc(alias = "miiSelectorBlacklistUserMii")] #[doc(alias = "miiSelectorBlacklistUserMii")]
pub fn blacklist_user_mii(&mut self, mii_index: Index) { pub fn blocklist_user_mii(&mut self, mii_index: Index) {
let index = match mii_index { let index = match mii_index {
Index::Index(i) => i, Index::Index(i) => i,
Index::All => ctru_sys::MIISELECTOR_USERMII_SLOTS, Index::All => ctru_sys::MIISELECTOR_USERMII_SLOTS,

Loading…
Cancel
Save