pub struct Configuration { /* private fields */ }
Expand description

A native AConfiguration *

Configuration is an opaque type used to get and set various subsystem configurations.

Implementations§

source§

impl Configuration

source

pub unsafe fn from_ptr(ptr: NonNull<AConfiguration>) -> Self

Construct a Configuration from a pointer.

Safety

By calling this function, you assert that it is a valid pointer to a native AConfiguration, and give ownership of it to the Configuration instance.

source

pub unsafe fn clone_from_ptr(ptr: NonNull<AConfiguration>) -> Self

Create a new Configuration, with the same contents as the AConfiguration referenced by the pointer.

This is useful if you have a pointer, but not ownership of it.

Safety

By calling this function, you assert that it is a valid pointer to a native AConfiguration.

source

pub fn ptr(&self) -> NonNull<AConfiguration>

The pointer to the native AConfiguration. Keep in mind that the Configuration object still has ownership, and will free it when dropped.

source

pub fn from_asset_manager(am: &AssetManager) -> Self

source

pub fn new() -> Self

Create a new Configuration, with none of the values set.

source

pub fn copy(&mut self, other: &Self)

dest.copy(&src) copies the contents of src to dest

source

pub fn diff(&self, other: &Self) -> DiffResult

Information about what fields differ between the two configurations

source

pub fn matches(&self, requested: &Self) -> bool

Returns false if anything in self conflicts with requested

source

pub fn country(&self) -> Option<String>

Returns the country code, as a String of two characters, if set

source

pub fn density(&self) -> Option<u32>

Returns the screen density in dpi.

On some devices it can return values outside of the density enum.

source

pub fn keyboard(&self) -> Keyboard

Returns the keyboard type.

source

pub fn keys_hidden(&self) -> KeysHidden

Returns keyboard visibility/availability.

source

pub fn language(&self) -> Option<String>

Returns the language, as a String of two characters, if set

source

pub fn layout_direction(&self) -> LayoutDir

Returns the layout direction

source

pub fn mcc(&self) -> i32

Returns the mobile country code.

source

pub fn mnc(&self) -> Option<i32>

Returns the mobile network code, if one is defined

source

pub fn nav_hidden(&self) -> NavHidden

source

pub fn navigation(&self) -> Navigation

source

pub fn orientation(&self) -> Orientation

source

pub fn screen_height_dp(&self) -> Option<i32>

source

pub fn screen_width_dp(&self) -> Option<i32>

source

pub fn screen_long(&self) -> ScreenLong

source

pub fn screen_round(&self) -> ScreenRound

Available on crate feature api-level-30 only.
source

pub fn screen_size(&self) -> ScreenSize

source

pub fn sdk_version(&self) -> i32

source

pub fn smallest_screen_width_dp(&self) -> Option<i32>

source

pub fn touchscreen(&self) -> Touchscreen

source

pub fn ui_mode_night(&self) -> UiModeNight

source

pub fn ui_mode_type(&self) -> UiModeType

Trait Implementations§

source§

impl Clone for Configuration

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Configuration

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Configuration

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl PartialEq for Configuration

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Configuration

source§

impl Send for Configuration

source§

impl Sync for Configuration

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.