Struct self_update::backends::github::ReleaseListBuilder
source · pub struct ReleaseListBuilder { /* private fields */ }
Expand description
ReleaseList
Builder
Implementations§
source§impl ReleaseListBuilder
impl ReleaseListBuilder
sourcepub fn repo_owner(&mut self, owner: &str) -> &mut Self
pub fn repo_owner(&mut self, owner: &str) -> &mut Self
Set the repo owner, used to build a github api url
Examples found in repository?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
fn run() -> Result<(), Box<dyn ::std::error::Error>> {
let mut rel_builder = self_update::backends::github::ReleaseList::configure();
#[cfg(feature = "signatures")]
rel_builder.repo_owner("Kijewski");
#[cfg(not(feature = "signatures"))]
rel_builder.repo_owner("jaemk");
let releases = rel_builder.repo_name("self_update").build()?.fetch()?;
println!("found releases:");
println!("{:#?}\n", releases);
let mut status_builder = self_update::backends::github::Update::configure();
#[cfg(feature = "signatures")]
status_builder
.repo_owner("Kijewski")
.verifying_keys([*include_bytes!("github-public.key")]);
#[cfg(not(feature = "signatures"))]
status_builder.repo_owner("jaemk");
let status = status_builder
.repo_name("self_update")
.bin_name("github")
.show_download_progress(true)
//.target_version_tag("v9.9.10")
//.show_output(false)
//.no_confirm(true)
//
// For private repos, you will need to provide a GitHub 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
//.auth_token(env!("DOWNLOAD_AUTH_TOKEN"))
.current_version(cargo_crate_version!())
.build()?
.update()?;
println!("Update status: `{}`!", status.version());
Ok(())
}
sourcepub fn repo_name(&mut self, name: &str) -> &mut Self
pub fn repo_name(&mut self, name: &str) -> &mut Self
Set the repo name, used to build a github api url
Examples found in repository?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
fn run() -> Result<(), Box<dyn ::std::error::Error>> {
let mut rel_builder = self_update::backends::github::ReleaseList::configure();
#[cfg(feature = "signatures")]
rel_builder.repo_owner("Kijewski");
#[cfg(not(feature = "signatures"))]
rel_builder.repo_owner("jaemk");
let releases = rel_builder.repo_name("self_update").build()?.fetch()?;
println!("found releases:");
println!("{:#?}\n", releases);
let mut status_builder = self_update::backends::github::Update::configure();
#[cfg(feature = "signatures")]
status_builder
.repo_owner("Kijewski")
.verifying_keys([*include_bytes!("github-public.key")]);
#[cfg(not(feature = "signatures"))]
status_builder.repo_owner("jaemk");
let status = status_builder
.repo_name("self_update")
.bin_name("github")
.show_download_progress(true)
//.target_version_tag("v9.9.10")
//.show_output(false)
//.no_confirm(true)
//
// For private repos, you will need to provide a GitHub 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
//.auth_token(env!("DOWNLOAD_AUTH_TOKEN"))
.current_version(cargo_crate_version!())
.build()?
.update()?;
println!("Update status: `{}`!", status.version());
Ok(())
}
sourcepub fn with_target(&mut self, target: &str) -> &mut Self
pub fn with_target(&mut self, target: &str) -> &mut Self
Set the optional arch target
name, used to filter available releases
sourcepub fn with_url(&mut self, url: &str) -> &mut Self
pub fn with_url(&mut self, url: &str) -> &mut Self
Set the optional github url, e.g. for a github enterprise installation.
The url should provide the path to your API endpoint and end without a trailing slash,
for example https://api.github.com
or https://github.mycorp.com/api/v3
sourcepub fn auth_token(&mut self, auth_token: &str) -> &mut Self
pub fn auth_token(&mut self, auth_token: &str) -> &mut Self
Set the authorization token, used in requests to the github api url
This is to support private repos where you need a GitHub 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
sourcepub fn build(&self) -> Result<ReleaseList>
pub fn build(&self) -> Result<ReleaseList>
Verify builder args, returning a ReleaseList
Examples found in repository?
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
fn run() -> Result<(), Box<dyn ::std::error::Error>> {
let mut rel_builder = self_update::backends::github::ReleaseList::configure();
#[cfg(feature = "signatures")]
rel_builder.repo_owner("Kijewski");
#[cfg(not(feature = "signatures"))]
rel_builder.repo_owner("jaemk");
let releases = rel_builder.repo_name("self_update").build()?.fetch()?;
println!("found releases:");
println!("{:#?}\n", releases);
let mut status_builder = self_update::backends::github::Update::configure();
#[cfg(feature = "signatures")]
status_builder
.repo_owner("Kijewski")
.verifying_keys([*include_bytes!("github-public.key")]);
#[cfg(not(feature = "signatures"))]
status_builder.repo_owner("jaemk");
let status = status_builder
.repo_name("self_update")
.bin_name("github")
.show_download_progress(true)
//.target_version_tag("v9.9.10")
//.show_output(false)
//.no_confirm(true)
//
// For private repos, you will need to provide a GitHub 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
//.auth_token(env!("DOWNLOAD_AUTH_TOKEN"))
.current_version(cargo_crate_version!())
.build()?
.update()?;
println!("Update status: `{}`!", status.version());
Ok(())
}
Trait Implementations§
source§impl Clone for ReleaseListBuilder
impl Clone for ReleaseListBuilder
source§fn clone(&self) -> ReleaseListBuilder
fn clone(&self) -> ReleaseListBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ReleaseListBuilder
impl RefUnwindSafe for ReleaseListBuilder
impl Send for ReleaseListBuilder
impl Sync for ReleaseListBuilder
impl Unpin for ReleaseListBuilder
impl UnwindSafe for ReleaseListBuilder
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