Skip to main content

Apps

Struct Apps 

Source
pub struct Apps { /* private fields */ }
Expand description

The installed programs and the person’s and the system’s choices of which opens what.

Implementations§

Source§

impl Apps

Source

pub fn load(dirs: &XdgDirs, lang: &str, path_var: Option<&OsStr>) -> Self

Reads the desktop entries below applications in every data folder and every mimeapps.list.

Of two entries with the same id the first found wins, so the person’s own copy overrides the system’s, and an entry marked Hidden hides the system’s copy as well as itself. Only Type=Application entries count. An entry whose TryExec program is not installed is dropped: an absolute path must be an executable file, a bare name is looked for in the folders of path_var. Entries marked NoDisplay are kept, since they are left out of menus but still open files. lang (tr_TR.UTF-8) picks the name: Name[tr_TR], then Name[tr], then Name. An application entry without a name, without an Exec line or with one that cannot be split is skipped with a Diagnostic, as is a line that cannot be read; its id stays taken, so a broken copy of the person’s never brings back the system’s.

Source

pub fn diagnostics(&self) -> &[Diagnostic]

The problems found while reading, in the order the files were read.

Source

pub fn all(&self) -> &[DesktopApp]

Every installed program, in the order found: the person’s own folder first, each folder in name order. A launcher leaves out the ones whose entry says NoDisplay.

Source

pub fn get(&self, id: &str) -> Option<&DesktopApp>

The program with this desktop file id, when it is installed.

Source

pub fn for_mime(&self, db: &MimeDb, mime: &str) -> Vec<&DesktopApp>

The programs that open a file of kind mime, the most fitting first, each once.

For mime and then each kind it is a special case of (MimeDb::ancestors): the defaults mimeapps.list names for it, then its [Added Associations], then the programs whose entries list it. A program in the [Removed Associations] of a kind is left out for that kind, unless a more important file adds it back. The mimeapps.list files are read in this order, the first the most important: <desktop>-mimeapps.list for each running desktop and then mimeapps.list, in the person’s configuration folder, in each system configuration folder, then below applications in the person’s data folder and in each system data folder. A listed id that is not installed is passed over.

Source

pub fn default_for(&self, db: &MimeDb, mime: &str) -> Option<&DesktopApp>

The program a file of kind mime opens with when nothing else is asked for: the one [Default Applications] names for the kind or, failing that, for the nearest kind it is a special case of; else the first of for_mime; else None.

Trait Implementations§

Source§

impl Clone for Apps

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Apps

Source§

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

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

impl Default for Apps

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Apps

§

impl RefUnwindSafe for Apps

§

impl Send for Apps

§

impl Sync for Apps

§

impl Unpin for Apps

§

impl UnsafeUnpin for Apps

§

impl UnwindSafe for Apps

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.