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
impl Install
Sourcepub fn new() -> Self
pub fn new() -> Self
The release archive into target_dir, telling the system about the new font.
Sourcepub fn target(self, dir: impl Into<PathBuf>) -> Self
pub fn target(self, dir: impl Into<PathBuf>) -> Self
Installs into dir instead of target_dir. The folder is created when missing.
Sourcepub fn register(self, register: bool) -> Self
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.
Sourcepub fn target_dir(&self) -> Option<&Path>
pub fn target_dir(&self) -> Option<&Path>
The folder the font goes into, if there is one.
Sourcepub fn run(
self,
cancel: &dyn Fn() -> bool,
on_progress: &mut dyn FnMut(Progress),
) -> Result<PathBuf, InstallError>
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.
Sourcepub fn task<Msg: Send + 'static>(
self,
on_progress: impl Fn(Progress) -> Msg + Send + Sync + 'static,
) -> Task<Msg>
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§
impl Eq for Install
impl StructuralPartialEq for Install
Auto Trait Implementations§
impl Freeze for Install
impl RefUnwindSafe for Install
impl Send for Install
impl Sync for Install
impl Unpin for Install
impl UnsafeUnpin for Install
impl UnwindSafe for Install
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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