Skip to main content

UpdateConfigBuilder

Struct UpdateConfigBuilder 

Source
pub struct UpdateConfigBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> UpdateConfigBuilder<S>

Source

pub fn build_async(self) -> AsyncUpdateChecker
where S: IsComplete,

Available on crate feature async only.

Build the configuration and return an AsyncUpdateChecker.

This is a convenience method that combines UpdateConfigBuilder::build with AsyncUpdateChecker::new.

nyquest_preset::register();
futures::executor::block_on(async {
    let checker = ib_update::github::UpdateConfig::builder()
        .owner("owner")
        .repo("repo")
        .current_version("1.0.0")
        .build_async();
    let info = checker.check().await?;
    println!("Latest: {}, update available: {}", info.latest().tag, info.has_update());
    Ok(())
})
Source§

impl<S: State> UpdateConfigBuilder<S>

Source

pub fn build_blocking(self) -> UpdateChecker
where S: IsComplete,

Available on crate feature blocking only.

Build the configuration and return an UpdateChecker.

This is a convenience method that combines UpdateConfigBuilder::build with UpdateChecker::new.

nyquest_preset::register();
let checker = ib_update::github::UpdateConfig::builder()
    .owner("owner")
    .repo("repo")
    .current_version("1.0.0")
    .build_blocking();
let info = checker.check()?;
println!("Latest: {}, update available: {}", info.latest().tag, info.has_update());
Source§

impl<S: State> UpdateConfigBuilder<S>

Source

pub fn build(self) -> UpdateConfig
where S: IsComplete,

Finish building and return the requested object

Source

pub fn owner(self, value: impl Into<String>) -> UpdateConfigBuilder<SetOwner<S>>
where S::Owner: IsUnset,

Required.

GitHub repository owner (e.g. "rust-lang").

Source

pub fn repo(self, value: impl Into<String>) -> UpdateConfigBuilder<SetRepo<S>>
where S::Repo: IsUnset,

Required.

GitHub repository name (e.g. "rust").

Source

pub fn current_version( self, value: impl Into<String>, ) -> UpdateConfigBuilder<SetCurrentVersion<S>>
where S::CurrentVersion: IsUnset,

Optional (Some / Option setters). Current version to compare against.

Source

pub fn maybe_current_version( self, value: Option<impl Into<String>>, ) -> UpdateConfigBuilder<SetCurrentVersion<S>>
where S::CurrentVersion: IsUnset,

Optional (Some / Option setters). Current version to compare against.

Source

pub fn token(self, value: impl Into<String>) -> UpdateConfigBuilder<SetToken<S>>
where S::Token: IsUnset,

Optional (Some / Option setters). Optional personal access token for higher rate limits.

Source

pub fn maybe_token( self, value: Option<impl Into<String>>, ) -> UpdateConfigBuilder<SetToken<S>>
where S::Token: IsUnset,

Optional (Some / Option setters). Optional personal access token for higher rate limits.

Source

pub fn base_urls( self, value: Vec<String>, ) -> UpdateConfigBuilder<SetBaseUrls<S>>
where S::BaseUrls: IsUnset,

Optional (Some / Option setters). Default: vec!["https://api.github.com".into()].

Base URLs for the GitHub API. Defaults to https://api.github.com only.

Source

pub fn maybe_base_urls( self, value: Option<Vec<String>>, ) -> UpdateConfigBuilder<SetBaseUrls<S>>
where S::BaseUrls: IsUnset,

Optional (Some / Option setters). Default: vec!["https://api.github.com".into()].

Base URLs for the GitHub API. Defaults to https://api.github.com only.

Source

pub fn user_agent( self, value: impl Into<String>, ) -> UpdateConfigBuilder<SetUserAgent<S>>
where S::UserAgent: IsUnset,

Optional (Some / Option setters). Custom user-agent header value.

Source

pub fn maybe_user_agent( self, value: Option<impl Into<String>>, ) -> UpdateConfigBuilder<SetUserAgent<S>>
where S::UserAgent: IsUnset,

Optional (Some / Option setters). Custom user-agent header value.

Source§

impl<S: State> UpdateConfigBuilder<S>

Source

pub fn base_url(self, url: String) -> UpdateConfigBuilder<SetBaseUrls<S>>
where S::BaseUrls: IsUnset,

Available on crate features github-extra and multi-server only.
Source

pub fn maybe_base_url( self, url: Option<String>, ) -> UpdateConfigBuilder<SetBaseUrls<S>>
where S::BaseUrls: IsUnset,

Available on crate features github-extra and multi-server only.

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, 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> MaybeAsyncRead for T
where T: ?Sized,

Source§

impl<T> MaybeRead for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.