Struct google_indexing3::client::DefaultDelegate
source · [−]pub struct DefaultDelegate;
Expand description
A delegate with a conservative default implementation, which is used if no other delegate is set.
Trait Implementations
sourceimpl Default for DefaultDelegate
impl Default for DefaultDelegate
sourcefn default() -> DefaultDelegate
fn default() -> DefaultDelegate
Returns the “default value” for a type. Read more
sourceimpl Delegate for DefaultDelegate
impl Delegate for DefaultDelegate
sourcefn begin(&mut self, _info: MethodInfo)
fn begin(&mut self, _info: MethodInfo)
Called at the beginning of any API request. The delegate should store the method
information if he is interesting in knowing more context when further calls to it
are made.
The matching finished()
call will always be made, no matter whether or not the API
request was successful. That way, the delegate may easily maintain a clean state
between various API calls. Read more
sourcefn http_error(&mut self, _err: &Error) -> Retry
fn http_error(&mut self, _err: &Error) -> Retry
sourcefn api_key(&mut self) -> Option<String>
fn api_key(&mut self) -> Option<String>
Called whenever there is the need for your applications API key after the official authenticator implementation didn’t provide one, for some reason. If this method returns None as well, the underlying operation will fail Read more
sourcefn token(&mut self, err: &Error) -> Option<AccessToken>
fn token(&mut self, err: &Error) -> Option<AccessToken>
Called whenever the Authenticator didn’t yield a token. The delegate may attempt to provide one, or just take it as a general information about the impending failure. The given Error provides information about why the token couldn’t be acquired in the first place Read more
sourcefn upload_url(&mut self) -> Option<String>
fn upload_url(&mut self) -> Option<String>
Called during resumable uploads to provide a URL for the impending upload.
It was saved after a previous call to store_upload_url(...)
, and if not None,
will be used instead of asking the server for a new upload URL.
This is useful in case a previous resumable upload was aborted/canceled, but should now
be resumed.
The returned URL will be used exactly once - if it fails again and the delegate allows
to retry, we will ask the server for a new upload URL. Read more
sourcefn store_upload_url(&mut self, url: Option<&str>)
fn store_upload_url(&mut self, url: Option<&str>)
Called after we have retrieved a new upload URL for a resumable upload to store it
in case we fail or cancel. That way, we can attempt to resume the upload later,
see upload_url()
.
It will also be called with None after a successful upload, which allows the delegate
to forget the URL. That way, we will not attempt to resume an upload that has already
finished. Read more
sourcefn response_json_decode_error(
&mut self,
json_encoded_value: &str,
json_decode_error: &Error
)
fn response_json_decode_error(
&mut self,
json_encoded_value: &str,
json_decode_error: &Error
)
Called whenever a server response could not be decoded from json. It’s for informational purposes only, the caller will return with an error accordingly. Read more
sourcefn http_failure(&mut self, _: &Response<Body>, _err: Option<Value>) -> Retry
fn http_failure(&mut self, _: &Response<Body>, _err: Option<Value>) -> Retry
Called whenever the http request returns with a non-success status code. This can involve authentication issues, or anything else that very much depends on the used API method. The delegate should check the status, header and decoded json error to decide whether to retry or not. In the latter case, the underlying call will fail. Read more
sourcefn pre_request(&mut self)
fn pre_request(&mut self)
Called prior to sending the main request of the given method. It can be used to time the call or to print progress information. It’s also useful as you can be sure that a request will definitely be made. Read more
sourcefn chunk_size(&mut self) -> u64
fn chunk_size(&mut self) -> u64
Return the size of each chunk of a resumable upload. Must be a power of two, with 1<<18 being the smallest allowed chunk size. Will be called once before starting any resumable upload. Read more
sourcefn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool
fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool
Called before the given chunk is uploaded to the server.
If true is returned, the upload will be interrupted.
However, it may be resumable if you stored the upload URL in a previous call
to store_upload_url()
Read more
Auto Trait Implementations
impl RefUnwindSafe for DefaultDelegate
impl Send for DefaultDelegate
impl Sync for DefaultDelegate
impl Unpin for DefaultDelegate
impl UnwindSafe for DefaultDelegate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more