Browse Source

Remove get_ from getters

pull/107/head
Andrea Ciliberti 2 years ago
parent
commit
da23524d7b
  1. 2
      ctru-rs/examples/camera-image.rs
  2. 4
      ctru-rs/examples/gfx-3d-mode.rs
  3. 2
      ctru-rs/examples/gfx-wide-mode.rs
  4. 2
      ctru-rs/examples/graphics-bitmap.rs
  5. 6
      ctru-rs/examples/system-configuration.rs
  6. 12
      ctru-rs/examples/title-info.rs
  7. 10
      ctru-rs/src/services/am.rs
  8. 6
      ctru-rs/src/services/cam.rs
  9. 6
      ctru-rs/src/services/cfgu.rs
  10. 6
      ctru-rs/src/services/fs.rs
  11. 6
      ctru-rs/src/services/gfx.rs

2
ctru-rs/examples/camera-image.rs

@ -88,7 +88,7 @@ fn main() { @@ -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,
);

4
ctru-rs/examples/gfx-3d-mode.rs

@ -35,8 +35,8 @@ fn main() { @@ -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 {

2
ctru-rs/examples/gfx-wide-mode.rs

@ -20,7 +20,7 @@ fn main() { @@ -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());

2
ctru-rs/examples/graphics-bitmap.rs

@ -31,7 +31,7 @@ fn main() { @@ -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 {

6
ctru-rs/examples/system-configuration.rs

@ -10,9 +10,9 @@ fn main() { @@ -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() {

12
ctru-rs/examples/title-info.rs

@ -13,17 +13,17 @@ fn main() { @@ -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() { @@ -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),
}

10
ctru-rs/src/services/am.rs

@ -29,7 +29,7 @@ impl<'a> Title<'a> { @@ -29,7 +29,7 @@ impl<'a> Title<'a> {
self.id
}
pub fn get_product_code(&self) -> crate::Result<String> {
pub fn product_code(&self) -> crate::Result<String> {
let mut buf: [u8; 16] = [0; 16];
unsafe {
@ -42,7 +42,7 @@ impl<'a> Title<'a> { @@ -42,7 +42,7 @@ impl<'a> Title<'a> {
Ok(String::from_utf8_lossy(&buf).to_string())
}
pub fn get_title_info(&self) -> crate::Result<TitleInfo> {
pub fn title_info(&self) -> crate::Result<TitleInfo> {
let mut info = MaybeUninit::zeroed();
unsafe {
@ -68,7 +68,7 @@ impl Am { @@ -68,7 +68,7 @@ impl Am {
}
}
pub fn get_title_count(&self, mediatype: FsMediaType) -> crate::Result<u32> {
pub fn title_count(&self, mediatype: FsMediaType) -> crate::Result<u32> {
unsafe {
let mut count = 0;
ResultCode(ctru_sys::AM_GetTitleCount(mediatype.into(), &mut count))?;
@ -76,8 +76,8 @@ impl Am { @@ -76,8 +76,8 @@ impl Am {
}
}
pub fn get_title_list(&self, mediatype: FsMediaType) -> crate::Result<Vec<Title>> {
let count = self.get_title_count(mediatype)?;
pub fn title_list(&self, mediatype: FsMediaType) -> crate::Result<Vec<Title>> {
let count = self.title_count(mediatype)?;
let mut buf = vec![0; count as usize];
let mut read_amount = 0;
unsafe {

6
ctru-rs/src/services/cam.rs

@ -280,7 +280,7 @@ pub trait Camera { @@ -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<u32> {
fn transfer_bytes(&self) -> crate::Result<u32> {
unsafe {
let mut transfer_bytes = 0;
ResultCode(ctru_sys::CAMU_GetTransferBytes(
@ -324,7 +324,7 @@ pub trait Camera { @@ -324,7 +324,7 @@ pub trait Camera {
}
/// Returns the [TrimmingParams] set
fn get_trimming_params(&self) -> crate::Result<TrimmingParams> {
fn trimming_params(&self) -> crate::Result<TrimmingParams> {
unsafe {
let mut x_start = 0;
let mut y_start = 0;
@ -660,7 +660,7 @@ pub trait Camera { @@ -660,7 +660,7 @@ pub trait Camera {
}
/// Returns the current [ImageQualityCalibrationData] for the camera
fn get_image_quality_calibration_data(&self) -> crate::Result<ImageQualityCalibrationData> {
fn image_quality_calibration_data(&self) -> crate::Result<ImageQualityCalibrationData> {
unsafe {
let mut data = ImageQualityCalibrationData::default();
ResultCode(ctru_sys::CAMU_GetImageQualityCalibrationData(&mut data.0))?;

6
ctru-rs/src/services/cfgu.rs

@ -67,7 +67,7 @@ impl Cfgu { @@ -67,7 +67,7 @@ impl Cfgu {
}
/// Gets system region from secure info
pub fn get_region(&self) -> crate::Result<Region> {
pub fn region(&self) -> crate::Result<Region> {
let mut region: u8 = 0;
ResultCode(unsafe { ctru_sys::CFGU_SecureInfoGetRegion(&mut region) })?;
@ -75,7 +75,7 @@ impl Cfgu { @@ -75,7 +75,7 @@ impl Cfgu {
}
/// Gets system's model
pub fn get_model(&self) -> crate::Result<SystemModel> {
pub fn model(&self) -> crate::Result<SystemModel> {
let mut model: u8 = 0;
ResultCode(unsafe { ctru_sys::CFGU_GetSystemModel(&mut model) })?;
@ -83,7 +83,7 @@ impl Cfgu { @@ -83,7 +83,7 @@ impl Cfgu {
}
/// Gets system's language
pub fn get_language(&self) -> crate::Result<Language> {
pub fn language(&self) -> crate::Result<Language> {
let mut language: u8 = 0;
ResultCode(unsafe { ctru_sys::CFGU_GetSystemLanguage(&mut language) })?;

6
ctru-rs/src/services/fs.rs

@ -329,7 +329,7 @@ impl Archive { @@ -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 { @@ -589,7 +589,7 @@ impl OpenOptions {
///
/// [`Archive`]: struct.Archive.html
pub fn open<P: AsRef<Path>>(&self, path: P) -> IoResult<File> {
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<File> {
@ -628,7 +628,7 @@ impl OpenOptions { @@ -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,

6
ctru-rs/src/services/gfx.rs

@ -33,7 +33,7 @@ pub trait Screen: private::Sealed { @@ -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 { @@ -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 { @@ -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() }
}
}

Loading…
Cancel
Save