[][src]Struct google_chat1::DefaultDelegate

pub struct DefaultDelegate;

A delegate with a conservative default implementation, which is used if no other delegate is set.

Trait Implementations

impl Delegate for DefaultDelegate[src]

fn begin(&mut self, MethodInfo)[src]

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

fn http_error(&mut self, &Error) -> Retry[src]

Called whenever there is an HttpError, usually if there are network problems. Read more

fn api_key(&mut self) -> Option<String>[src]

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

fn token(&mut self, err: &dyn Error) -> Option<Token>[src]

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

fn upload_url(&mut self) -> Option<String>[src]

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

fn store_upload_url(&mut self, url: Option<&str>)[src]

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

fn response_json_decode_error(
    &mut self,
    json_encoded_value: &str,
    json_decode_error: &Error
)
[src]

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

fn http_failure(
    &mut self,
    _: &Response,
    Option<JsonServerError>,
    _: Option<ServerError>
) -> Retry
[src]

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

fn pre_request(&mut self)[src]

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

fn chunk_size(&mut self) -> u64[src]

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

fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool[src]

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

fn finished(&mut self, is_success: bool)[src]

Called before the API request method returns, in every case. It can be used to clean up internal state between calls to the API. This call always has a matching call to begin(...). Read more

impl Default for DefaultDelegate[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.