Struct ctru::services::ps::Ps

source ·
pub struct Ps(/* private fields */);
Expand description

Handle to the PS service.

Implementations§

source§

impl Ps

source

pub fn new() -> Result<Self>

Initialize a new service handle.

§Example
use ctru::services::ps::Ps;

let ps = Ps::new()?;
source

pub fn local_friend_code_seed(&self) -> Result<u64>

Returns the console’s local friend code seed.

§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;

let friend_code_seed = ps.local_friend_code_seed()?;
source

pub fn device_id(&self) -> Result<u32>

Returns the console’s devide ID.

§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;

let device_id = ps.device_id()?;
source

pub fn generate_random_bytes(&self, out: &mut [u8]) -> Result<()>

Generates cryptografically secure random bytes and writes them into the out buffer.

§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;

let mut buffer = vec![0; 128];

// The buffer is now randomized!
ps.generate_random_bytes(&mut buffer)?;

Trait Implementations§

source§

impl Drop for Ps

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Ps

§

impl Send for Ps

§

impl Sync for Ps

§

impl Unpin for Ps

§

impl UnwindSafe for Ps

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.