Struct ctru::services::cam::Cam

source ·
pub struct Cam {
    pub inner_cam: InwardCam,
    pub outer_right_cam: OutwardRightCam,
    pub outer_left_cam: OutwardLeftCam,
    pub both_outer_cams: BothOutwardCam,
    /* private fields */
}
Expand description

Handle to the Camera service.

Fields§

§inner_cam: InwardCam

Inside-facing camera.

§outer_right_cam: OutwardRightCam

Outside-facing right camera.

§outer_left_cam: OutwardLeftCam

Outside-facing left camera.

§both_outer_cams: BothOutwardCam

Both outside-facing cameras (mainly used for 3D photos).

Implementations§

source§

impl Cam

source

pub fn new() -> Result<Cam>

Initialize a new service handle.

§Notes

All cameras default to taking photos with ViewSize::TopLCD and OutputFormat::Yuv422. Have a look at Camera::set_view_size() and Camera::set_output_format() to change these settings.

§Errors

This function will return an error if the service was unable to be initialized. Since this service requires no special or elevated permissions, errors are rare in practice.

§Example
use ctru::services::cam::Cam;

let cam = Cam::new()?;
source

pub fn play_shutter_sound(&self, sound: ShutterSound) -> Result<()>

Play the specified sound based on the ShutterSound argument

§Notes

Playing the shutter sound does not require a living handle to the Ndsp service. Volume will always be maxed out to ensure everyone within photo range can hear the picture being taken (as by Japanese law).

§Example
use ctru::services::cam::{Cam, ShutterSound};
let cam = Cam::new()?;

// We play the shutter sound on the console's speakers!
// (even though we aren't taking a photo :P)
cam.play_shutter_sound(ShutterSound::Normal);

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cam

§

impl !Send for Cam

§

impl Sync for Cam

§

impl Unpin for Cam

§

impl !UnwindSafe for Cam

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, 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.