pub struct LaunchArgs { /* private fields */ }Expand description
The launch arguments the app was started with.
An immutable snapshot: reading it never allocates, so composables may query
it per frame. The platform replaces the whole snapshot when the launch
parameters change (Android onNewIntent); it never mutates one in place.
Implementations§
Source§impl LaunchArgs
impl LaunchArgs
Sourcepub fn new(
entries: impl IntoIterator<Item = (String, LaunchArgValue)>,
debuggable: bool,
) -> LaunchArgs
pub fn new( entries: impl IntoIterator<Item = (String, LaunchArgValue)>, debuggable: bool, ) -> LaunchArgs
Builds a snapshot from named values.
Platform backends call this; apps read launch_args instead. A
repeated name keeps the first value, matching a Bundle, where the
later putExtra of the same key is what the caller has to avoid.
Sourcepub fn is_debuggable(&self) -> bool
pub fn is_debuggable(&self) -> bool
Whether the OS considers this build debuggable — Android’s
ApplicationInfo.FLAG_DEBUGGABLE, cfg!(debug_assertions) elsewhere.
Gate debug and instrumentation options on this. It is the only check
that stays correct in a shipped build: a release APK reports false
even when someone passes the extras, so the options cannot be turned on
from the outside.
Sourcepub fn contains(&self, name: &str) -> bool
pub fn contains(&self, name: &str) -> bool
Whether an argument with this name was supplied, whatever its type.
The reference pattern is a single presence flag (ob_debug) that
switches a whole block of options on.
Sourcepub fn names(&self) -> impl Iterator<Item = &str>
pub fn names(&self) -> impl Iterator<Item = &str>
The names supplied, in the order the platform reported them.
Sourcepub fn value(&self, name: &str) -> Option<&LaunchArgValue>
pub fn value(&self, name: &str) -> Option<&LaunchArgValue>
The raw value, in the type the platform delivered.
Sourcepub fn boolean(&self, name: &str) -> Option<bool>
pub fn boolean(&self, name: &str) -> Option<bool>
Reads a boolean argument.
Accepts a Bool value, or text spelled true/false, 1/0,
yes/no, on/off in any case. A number is not coerced: an
--ei flag 1 that was meant to be --ez flag true reads as None
rather than silently enabling something.
Sourcepub fn int(&self, name: &str) -> Option<i32>
pub fn int(&self, name: &str) -> Option<i32>
Reads a 32-bit integer argument.
Accepts an Int, a Long that fits, or text.
Sourcepub fn long(&self, name: &str) -> Option<i64>
pub fn long(&self, name: &str) -> Option<i64>
Reads a 64-bit integer argument.
Accepts a Long, an Int, or text. Seeds are the usual case, and a
seed written as --ei still reads back here.
Trait Implementations§
Source§impl Clone for LaunchArgs
impl Clone for LaunchArgs
Source§fn clone(&self) -> LaunchArgs
fn clone(&self) -> LaunchArgs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LaunchArgs
impl Debug for LaunchArgs
Source§impl Default for LaunchArgs
impl Default for LaunchArgs
Source§fn default() -> LaunchArgs
fn default() -> LaunchArgs
Source§impl PartialEq for LaunchArgs
impl PartialEq for LaunchArgs
impl StructuralPartialEq for LaunchArgs
Auto Trait Implementations§
impl Freeze for LaunchArgs
impl RefUnwindSafe for LaunchArgs
impl Send for LaunchArgs
impl Sync for LaunchArgs
impl Unpin for LaunchArgs
impl UnsafeUnpin for LaunchArgs
impl UnwindSafe for LaunchArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.