pub struct UbiBuilder<'a> { /* private fields */ }Expand description
UbiBuilder is used to create a Ubi instance.
Implementations§
Source§impl<'a> UbiBuilder<'a>
impl<'a> UbiBuilder<'a>
Sourcepub fn project(self, project: &'a str) -> Self
pub fn project(self, project: &'a str) -> Self
Set the project to download from. This can either be just the org/name, like
houseabsolute/precious, or the complete forge site URL to the project, like
https://github.com/houseabsolute/precious or https://gitlab.com/gitlab-org/cli. It also
accepts a URL to any page in the project, like
https://github.com/houseabsolute/precious/releases.
You must set this or set url, but not both.
Sourcepub fn tag(self, tag: &'a str) -> Self
pub fn tag(self, tag: &'a str) -> Self
Set the tag to download. By default the most recent release is downloaded. You cannot set
this with the url option.
Sourcepub fn url(self, url: &'a str) -> Self
pub fn url(self, url: &'a str) -> Self
Set the URL to download from. This can be provided instead of a project or tag. This will not use the forge site API, so you will never hit API limits. That in turn means you won’t have to set a token env var except when downloading a release from a private repo when the URL is set.
You must set this or set project, but not both.
Sourcepub fn install_dir(self, install_dir: PathBuf) -> Self
pub fn install_dir(self, install_dir: PathBuf) -> Self
Set the directory to install the binary in. If not set, it will default to ./bin.
Sourcepub fn matching(self, matching: &'a str) -> Self
pub fn matching(self, matching: &'a str) -> Self
Set a string to match against the release filename when there are multiple files for your OS/arch, i.e. “gnu” or “musl”. Note that this is only used when there is more than one matching release filename for your OS/arch. If only one release asset matches your OS/arch, then this will be ignored.
Sourcepub fn exe(self, exe: &'a str) -> Self
pub fn exe(self, exe: &'a str) -> Self
Set the name of the executable to look for in archive files. By default this is the same as
the project name, so for houseabsolute/precious we look for precious or
precious.exe. When running on Windows the “.exe” suffix will be added as needed.
Sourcepub fn github_token(self, token: &'a str) -> Self
pub fn github_token(self, token: &'a str) -> Self
Set a GitHub token to use for API requests. If this is not set then this will be taken from
the GITHUB_TOKEN env var if it is set.
Sourcepub fn gitlab_token(self, token: &'a str) -> Self
pub fn gitlab_token(self, token: &'a str) -> Self
Set a GitLab token to use for API requests. If this is not set then this will be taken from
the CI_JOB_TOKEN or GITLAB_TOKEN env var, if one of these is set. If both are set, then
the value in CI_JOB_TOKEN will be used.
Sourcepub fn platform(self, platform: &'a Platform) -> Self
pub fn platform(self, platform: &'a Platform) -> Self
Set the platform to download for. If not set it will be determined based on the current platform’s OS/arch.
Sourcepub fn is_musl(self, is_musl: bool) -> Self
pub fn is_musl(self, is_musl: bool) -> Self
Set whether or not the platform uses musl as its libc. This is only relevant for Linux
platforms. If this isn’t set then it will be determined based on the current platform’s
libc. You cannot set this to true on a non-Linux platform.
Sourcepub fn forge(self, forge: ForgeType) -> Self
pub fn forge(self, forge: ForgeType) -> Self
Set the forge type to use for fetching assets and release information. This determines which REST API is used to get information about releases and to download the release. If this isn’t set, then this will be determined from the hostname in the url, if that is set. Otherwise, the default is GitHub.
Sourcepub fn api_base_url(self, api_base_url: &'a str) -> Self
pub fn api_base_url(self, api_base_url: &'a str) -> Self
Set the base URL for the forge site’s API. This is useful for testing or if you want to
operate against an Enterprise version of GitHub or GitLab. This should be something like
https://github.my-corp.example.com/api/v4.
Trait Implementations§
Source§impl<'a> Debug for UbiBuilder<'a>
impl<'a> Debug for UbiBuilder<'a>
Source§impl<'a> Default for UbiBuilder<'a>
impl<'a> Default for UbiBuilder<'a>
Source§fn default() -> UbiBuilder<'a>
fn default() -> UbiBuilder<'a>
Auto Trait Implementations§
impl<'a> Freeze for UbiBuilder<'a>
impl<'a> RefUnwindSafe for UbiBuilder<'a>
impl<'a> Send for UbiBuilder<'a>
impl<'a> Sync for UbiBuilder<'a>
impl<'a> Unpin for UbiBuilder<'a>
impl<'a> UnwindSafe for UbiBuilder<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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