Struct google_cloud_bigquery::query::ConstantBuilder
source · pub struct ConstantBuilder { /* private fields */ }Expand description
ConstantBuilder is used to build ConstantBackoff
§Default
- delay: 1s
- max times: 3
§Examples
use anyhow::Result;
use backon::ConstantBuilder;
use backon::Retryable;
async fn fetch() -> Result<String> {
Ok(reqwest::get("https://www.rust-lang.org")
.await?
.text()
.await?)
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let content = fetch.retry(&ConstantBuilder::default()).await?;
println!("fetch succeeded: {}", content);
Ok(())
}Implementations§
source§impl ConstantBuilder
impl ConstantBuilder
sourcepub fn with_delay(self, delay: Duration) -> ConstantBuilder
pub fn with_delay(self, delay: Duration) -> ConstantBuilder
Set delay of current backoff.
sourcepub fn with_max_times(self, max_times: usize) -> ConstantBuilder
pub fn with_max_times(self, max_times: usize) -> ConstantBuilder
Set max times of current backoff.
sourcepub fn with_jitter(self) -> ConstantBuilder
pub fn with_jitter(self) -> ConstantBuilder
Set jitter on
Trait Implementations§
source§impl BackoffBuilder for ConstantBuilder
impl BackoffBuilder for ConstantBuilder
§type Backoff = ConstantBackoff
type Backoff = ConstantBackoff
The associated backoff that returned by this builder.
source§fn build(&self) -> <ConstantBuilder as BackoffBuilder>::Backoff
fn build(&self) -> <ConstantBuilder as BackoffBuilder>::Backoff
Builder a new backoff via builder.
source§impl Clone for ConstantBuilder
impl Clone for ConstantBuilder
source§fn clone(&self) -> ConstantBuilder
fn clone(&self) -> ConstantBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ConstantBuilder
impl Debug for ConstantBuilder
source§impl Default for ConstantBuilder
impl Default for ConstantBuilder
source§fn default() -> ConstantBuilder
fn default() -> ConstantBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConstantBuilder
impl RefUnwindSafe for ConstantBuilder
impl Send for ConstantBuilder
impl Sync for ConstantBuilder
impl Unpin for ConstantBuilder
impl UnwindSafe for ConstantBuilder
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
Mutably borrows from an owned value. Read more
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request