From da23524d7b176274454f2c0a491a5b50ca108005 Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Fri, 31 Mar 2023 15:45:46 +0200 Subject: [PATCH] Remove get_ from getters --- ctru-rs/examples/camera-image.rs | 2 +- ctru-rs/examples/gfx-3d-mode.rs | 4 ++-- ctru-rs/examples/gfx-wide-mode.rs | 2 +- ctru-rs/examples/graphics-bitmap.rs | 2 +- ctru-rs/examples/system-configuration.rs | 6 +++--- ctru-rs/examples/title-info.rs | 12 ++++++------ ctru-rs/src/services/am.rs | 10 +++++----- ctru-rs/src/services/cam.rs | 6 +++--- ctru-rs/src/services/cfgu.rs | 6 +++--- ctru-rs/src/services/fs.rs | 6 +++--- ctru-rs/src/services/gfx.rs | 6 +++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ctru-rs/examples/camera-image.rs b/ctru-rs/examples/camera-image.rs index 41aa9f3..4303c2c 100644 --- a/ctru-rs/examples/camera-image.rs +++ b/ctru-rs/examples/camera-image.rs @@ -88,7 +88,7 @@ fn main() { rotate_image_to_screen( &buf, - gfx.top_screen.borrow_mut().get_raw_framebuffer().ptr, + gfx.top_screen.borrow_mut().raw_framebuffer().ptr, WIDTH, HEIGHT, ); diff --git a/ctru-rs/examples/gfx-3d-mode.rs b/ctru-rs/examples/gfx-3d-mode.rs index da7150a..ca47c09 100644 --- a/ctru-rs/examples/gfx-3d-mode.rs +++ b/ctru-rs/examples/gfx-3d-mode.rs @@ -35,8 +35,8 @@ fn main() { break; } - let left_buf = left.get_raw_framebuffer(); - let right_buf = right.get_raw_framebuffer(); + let left_buf = left.raw_framebuffer(); + let right_buf = right.raw_framebuffer(); // Clear both buffers every time, in case the user switches sides this loop unsafe { diff --git a/ctru-rs/examples/gfx-wide-mode.rs b/ctru-rs/examples/gfx-wide-mode.rs index ae263cd..80f73b1 100644 --- a/ctru-rs/examples/gfx-wide-mode.rs +++ b/ctru-rs/examples/gfx-wide-mode.rs @@ -20,7 +20,7 @@ fn main() { if hid.keys_down().contains(KeyPad::A) { drop(console); - let wide_mode = gfx.top_screen.borrow().get_wide_mode(); + let wide_mode = gfx.top_screen.borrow().is_wide(); gfx.top_screen.borrow_mut().set_wide_mode(!wide_mode); console = Console::init(gfx.top_screen.borrow_mut()); diff --git a/ctru-rs/examples/graphics-bitmap.rs b/ctru-rs/examples/graphics-bitmap.rs index e2b7def..6ed90e1 100644 --- a/ctru-rs/examples/graphics-bitmap.rs +++ b/ctru-rs/examples/graphics-bitmap.rs @@ -31,7 +31,7 @@ fn main() { bottom_screen.set_double_buffering(false); // We assume the image is the correct size already, so we drop width + height. - let frame_buffer = bottom_screen.get_raw_framebuffer(); + let frame_buffer = bottom_screen.raw_framebuffer(); // Copy the image into the frame buffer unsafe { diff --git a/ctru-rs/examples/system-configuration.rs b/ctru-rs/examples/system-configuration.rs index fde7d18..49787ee 100644 --- a/ctru-rs/examples/system-configuration.rs +++ b/ctru-rs/examples/system-configuration.rs @@ -10,9 +10,9 @@ fn main() { let cfgu = Cfgu::init().expect("Couldn't obtain CFGU controller"); let _console = Console::init(gfx.top_screen.borrow_mut()); - println!("\x1b[0;0HRegion: {:?}", cfgu.get_region().unwrap()); - println!("\x1b[10;0HLanguage: {:?}", cfgu.get_language().unwrap()); - println!("\x1b[20;0HModel: {:?}", cfgu.get_model().unwrap()); + println!("\x1b[0;0HRegion: {:?}", cfgu.region().unwrap()); + println!("\x1b[10;0HLanguage: {:?}", cfgu.language().unwrap()); + println!("\x1b[20;0HModel: {:?}", cfgu.model().unwrap()); // Main loop while apt.main_loop() { diff --git a/ctru-rs/examples/title-info.rs b/ctru-rs/examples/title-info.rs index 6dd39a6..c904e96 100644 --- a/ctru-rs/examples/title-info.rs +++ b/ctru-rs/examples/title-info.rs @@ -13,17 +13,17 @@ fn main() { let bottom_screen = Console::init(gfx.bottom_screen.borrow_mut()); let sd_count = am - .get_title_count(FsMediaType::Sd) + .title_count(FsMediaType::Sd) .expect("Failed to get sd title count"); let sd_list = am - .get_title_list(FsMediaType::Sd) + .title_list(FsMediaType::Sd) .expect("Failed to get sd title list"); let nand_count = am - .get_title_count(FsMediaType::Nand) + .title_count(FsMediaType::Nand) .expect("Failed to get nand title count"); let nand_list = am - .get_title_list(FsMediaType::Nand) + .title_list(FsMediaType::Nand) .expect("Failed to get nand title list"); let mut offset = 0; @@ -80,14 +80,14 @@ fn main() { // Move cursor to top left println!("\x1b[1;1"); - match selected_title.get_title_info() { + match selected_title.title_info() { Ok(info) => { println!("Size: {} KB", info.size_bytes() / 1024); println!("Version: 0x{:x}", info.version()); } Err(e) => println!("Failed to get title info: {}", e), } - match selected_title.get_product_code() { + match selected_title.product_code() { Ok(code) => println!("Product code: \"{code}\""), Err(e) => println!("Failed to get product code: {}", e), } diff --git a/ctru-rs/src/services/am.rs b/ctru-rs/src/services/am.rs index d090660..ada179e 100644 --- a/ctru-rs/src/services/am.rs +++ b/ctru-rs/src/services/am.rs @@ -29,7 +29,7 @@ impl<'a> Title<'a> { self.id } - pub fn get_product_code(&self) -> crate::Result { + pub fn product_code(&self) -> crate::Result { let mut buf: [u8; 16] = [0; 16]; unsafe { @@ -42,7 +42,7 @@ impl<'a> Title<'a> { Ok(String::from_utf8_lossy(&buf).to_string()) } - pub fn get_title_info(&self) -> crate::Result { + pub fn title_info(&self) -> crate::Result { let mut info = MaybeUninit::zeroed(); unsafe { @@ -68,7 +68,7 @@ impl Am { } } - pub fn get_title_count(&self, mediatype: FsMediaType) -> crate::Result { + pub fn title_count(&self, mediatype: FsMediaType) -> crate::Result { unsafe { let mut count = 0; ResultCode(ctru_sys::AM_GetTitleCount(mediatype.into(), &mut count))?; @@ -76,8 +76,8 @@ impl Am { } } - pub fn get_title_list(&self, mediatype: FsMediaType) -> crate::Result> { - let count = self.get_title_count(mediatype)?; + pub fn title_list(&self, mediatype: FsMediaType) -> crate::Result> { + let count = self.title_count(mediatype)?; let mut buf = vec![0; count as usize]; let mut read_amount = 0; unsafe { diff --git a/ctru-rs/src/services/cam.rs b/ctru-rs/src/services/cam.rs index 2f0f29f..bca6c65 100644 --- a/ctru-rs/src/services/cam.rs +++ b/ctru-rs/src/services/cam.rs @@ -280,7 +280,7 @@ pub trait Camera { /// Returns the maximum amount of transfer bytes based on the view size, trimming, and other /// modifications set to the camera - fn get_transfer_bytes(&self) -> crate::Result { + fn transfer_bytes(&self) -> crate::Result { unsafe { let mut transfer_bytes = 0; ResultCode(ctru_sys::CAMU_GetTransferBytes( @@ -324,7 +324,7 @@ pub trait Camera { } /// Returns the [TrimmingParams] set - fn get_trimming_params(&self) -> crate::Result { + fn trimming_params(&self) -> crate::Result { unsafe { let mut x_start = 0; let mut y_start = 0; @@ -660,7 +660,7 @@ pub trait Camera { } /// Returns the current [ImageQualityCalibrationData] for the camera - fn get_image_quality_calibration_data(&self) -> crate::Result { + fn image_quality_calibration_data(&self) -> crate::Result { unsafe { let mut data = ImageQualityCalibrationData::default(); ResultCode(ctru_sys::CAMU_GetImageQualityCalibrationData(&mut data.0))?; diff --git a/ctru-rs/src/services/cfgu.rs b/ctru-rs/src/services/cfgu.rs index 0d1b19c..12857c6 100644 --- a/ctru-rs/src/services/cfgu.rs +++ b/ctru-rs/src/services/cfgu.rs @@ -67,7 +67,7 @@ impl Cfgu { } /// Gets system region from secure info - pub fn get_region(&self) -> crate::Result { + pub fn region(&self) -> crate::Result { let mut region: u8 = 0; ResultCode(unsafe { ctru_sys::CFGU_SecureInfoGetRegion(&mut region) })?; @@ -75,7 +75,7 @@ impl Cfgu { } /// Gets system's model - pub fn get_model(&self) -> crate::Result { + pub fn model(&self) -> crate::Result { let mut model: u8 = 0; ResultCode(unsafe { ctru_sys::CFGU_GetSystemModel(&mut model) })?; @@ -83,7 +83,7 @@ impl Cfgu { } /// Gets system's language - pub fn get_language(&self) -> crate::Result { + pub fn language(&self) -> crate::Result { let mut language: u8 = 0; ResultCode(unsafe { ctru_sys::CFGU_GetSystemLanguage(&mut language) })?; diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index dd8b520..512debb 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -329,7 +329,7 @@ impl Archive { /// Retrieves an Archive's [`ArchiveID`] /// /// [`ArchiveID`]: enum.ArchiveID.html - pub fn get_id(&self) -> ArchiveID { + pub fn id(&self) -> ArchiveID { self.id } } @@ -589,7 +589,7 @@ impl OpenOptions { /// /// [`Archive`]: struct.Archive.html pub fn open>(&self, path: P) -> IoResult { - self._open(path.as_ref(), self.get_open_flags()) + self._open(path.as_ref(), self.open_flags()) } fn _open(&self, path: &Path, flags: FsOpen) -> IoResult { @@ -628,7 +628,7 @@ impl OpenOptions { } } - fn get_open_flags(&self) -> FsOpen { + fn open_flags(&self) -> FsOpen { match (self.read, self.write || self.append, self.create) { (true, false, false) => FsOpen::FS_OPEN_READ, (false, true, false) => FsOpen::FS_OPEN_WRITE, diff --git a/ctru-rs/src/services/gfx.rs b/ctru-rs/src/services/gfx.rs index 355e938..f4a580a 100644 --- a/ctru-rs/src/services/gfx.rs +++ b/ctru-rs/src/services/gfx.rs @@ -33,7 +33,7 @@ pub trait Screen: private::Sealed { /// /// Note that the pointer of the framebuffer returned by this function can /// change after each call to this function if double buffering is enabled. - fn get_raw_framebuffer(&mut self) -> RawFrameBuffer { + fn raw_framebuffer(&mut self) -> RawFrameBuffer { let mut width = 0; let mut height = 0; let ptr = unsafe { @@ -56,7 +56,7 @@ pub trait Screen: private::Sealed { } /// Gets the framebuffer format - fn get_framebuffer_format(&self) -> FramebufferFormat { + fn framebuffer_format(&self) -> FramebufferFormat { unsafe { ctru_sys::gfxGetScreenFormat(self.as_raw()) }.into() } @@ -238,7 +238,7 @@ impl TopScreen { } /// Returns whether or not wide mode is enabled on the top screen. - pub fn get_wide_mode(&self) -> bool { + pub fn is_wide(&self) -> bool { unsafe { ctru_sys::gfxIsWide() } } }