Skip to main content

Install

Struct Install 

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

How to install the font: the archive, the folder and whether the system is told.

Install::new is what install runs. The other methods are for installing elsewhere, such as into a test’s temporary folder.

Implementations§

Source§

impl Install

Source

pub fn new() -> Self

The release archive into target_dir, telling the system about the new font.

Source

pub fn archive(self, archive: Archive) -> Self

Installs from archive instead of the release.

Source

pub fn target(self, dir: impl Into<PathBuf>) -> Self

Installs into dir instead of target_dir. The folder is created when missing.

Source

pub fn register(self, register: bool) -> Self

Whether the system is told about the new font, on by default: on Linux fc-cache -f reads the folder (skipped when fontconfig is not installed), on Windows the font is entered under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Fonts, and macOS needs nothing. Turn it off for a folder the system does not look at.

Source

pub fn target_dir(&self) -> Option<&Path>

The folder the font goes into, if there is one.

Source

pub fn run( self, cancel: &dyn Fn() -> bool, on_progress: &mut dyn FnMut(Progress), ) -> Result<PathBuf, InstallError>

Downloads, verifies and installs, on the calling thread, handing every step to on_progress; the last one is Progress::Done or Progress::Failed. Returns the path Progress::Done names.

cancel is asked between steps and while a program runs; when it turns true the program is stopped and nothing more is written. The download is kept in a folder of its own under the system’s temporary folder and removed at the end, whatever the outcome.

§Errors

Every way the install can fail is an InstallError, also handed to on_progress as Progress::Failed unless the install was cancelled.

Source

pub fn task<Msg: Send + 'static>( self, on_progress: impl Fn(Progress) -> Msg + Send + Sync + 'static, ) -> Task<Msg>

The install as a background Task. Every step arrives as on_progress(step), and the task’s own result is on_progress(Progress::Done { .. }). A failure arrives as Progress::Failed and also fails the task with the same text, so a TaskList shows it; the task’s label and notes are translated when this is called, so call it where the application’s language is active, such as in update.

Trait Implementations§

Source§

impl Clone for Install

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 Install

Source§

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

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

impl Default for Install

Source§

fn default() -> Self

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

impl Eq for Install

Source§

impl PartialEq for Install

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Install

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.