Struct self_update::backends::gitea::UpdateBuilder

source ·
pub struct UpdateBuilder { /* private fields */ }
Expand description

gitea::Update builder

Configure download and installation from https://<gitea-host>/api/v1/repos/<repo_owner>/<repo_name>/releases

Implementations§

source§

impl UpdateBuilder

source

pub fn new() -> Self

Initialize a new builder

source

pub fn with_host(&mut self, host: &str) -> &mut Self

Set the gitea host url

source

pub fn repo_owner(&mut self, owner: &str) -> &mut Self

Set the repo owner, used to build a gitea api url

source

pub fn repo_name(&mut self, name: &str) -> &mut Self

Set the repo name, used to build a gitea api url

source

pub fn current_version(&mut self, ver: &str) -> &mut Self

Set the current app version, used to compare against the latest available version. The cargo_crate_version! macro can be used to pull the version from your Cargo.toml

source

pub fn target_version_tag(&mut self, ver: &str) -> &mut Self

Set the target version tag to update to. This will be used to search for a release by tag name: /repos/:owner%2F:repo/releases/:tag

If not specified, the latest available release is used.

source

pub fn target(&mut self, target: &str) -> &mut Self

Set the target triple that will be downloaded, e.g. x86_64-unknown-linux-gnu.

If unspecified, the build target of the crate will be used

source

pub fn bin_name(&mut self, name: &str) -> &mut Self

Set the exe’s name. Also sets bin_path_in_archive if it hasn’t already been set.

This method will append the platform specific executable file suffix (see std::env::consts::EXE_SUFFIX) to the name if it’s missing.

source

pub fn bin_install_path<A: AsRef<Path>>( &mut self, bin_install_path: A ) -> &mut Self

Set the installation path for the new exe, defaults to the current executable’s path

source

pub fn bin_path_in_archive(&mut self, bin_path: &str) -> &mut Self

Set the path of the exe inside the release tarball. This is the location of the executable relative to the base of the tar’d directory and is the path that will be copied to the bin_install_path. If not specified, this will default to the value of bin_name. This only needs to be specified if the path to the binary (from the root of the tarball) is not equal to just the bin_name.

This also supports variable paths:

  • {{ bin }} is replaced with the value of bin_name
  • {{ target }} is replaced with the value of target
  • {{ version }} is replaced with the value of target_version if set, otherwise the value of the latest available release version is used.
§Example

For a myapp binary with windows target and latest release version 1.2.3, the tarball myapp.tar.gz has the contents:

myapp.tar/
 |------- windows-1.2.3-bin/
 |         |--- myapp  # <-- executable

The path provided should be:

Update::configure()
    .bin_path_in_archive("{{ target }}-{{ version }}-bin/{{ bin }}")
source

pub fn show_download_progress(&mut self, show: bool) -> &mut Self

Toggle download progress bar, defaults to off.

source

pub fn set_progress_style( &mut self, progress_template: String, progress_chars: String ) -> &mut Self

Set download progress style.

source

pub fn show_output(&mut self, show: bool) -> &mut Self

Toggle update output information, defaults to true.

source

pub fn no_confirm(&mut self, no_confirm: bool) -> &mut Self

Toggle download confirmation. Defaults to false.

source

pub fn auth_token(&mut self, auth_token: &str) -> &mut Self

Set the authorization token, used in requests to the gitea api url

This is to support private repos where you need a gitea auth token. Make sure not to bake the token into your app; it is recommended you obtain it via another mechanism, such as environment variables or prompting the user for input

source

pub fn verifying_keys(&mut self, keys: impl Into<Vec<[u8; 32]>>) -> &mut Self

Specify a slice of ed25519ph verifying keys to validate a download’s authenticy

If the feature is activated AND at least one key was provided, a download is verifying. At least one key has to match.

source

pub fn build(&self) -> Result<Box<dyn ReleaseUpdate>>

Confirm config and create a ready-to-use Update

  • Errors:
    • Config - Invalid Update configuration

Trait Implementations§

source§

impl Debug for UpdateBuilder

source§

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

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

impl Default for UpdateBuilder

source§

fn default() -> Self

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

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more