pub struct GmailClientBuilder { /* private fields */ }
Expand description
The GmailClientBuilder
is the intended way of creating a GmailClient
.
Implementations§
Source§impl<'a> GmailClientBuilder
impl<'a> GmailClientBuilder
Sourcepub fn new<P: AsRef<Path>, S: Into<String>>(
service_account_path: P,
send_from_email: S,
) -> Result<Self>
pub fn new<P: AsRef<Path>, S: Into<String>>( service_account_path: P, send_from_email: S, ) -> Result<Self>
Create a new GmailClientBuilder
.
Will return an error if unable to read & parse the service_account_path
if, for example, the file does not exist or has an incorrect format.
Sourcepub fn mock_mode(self, enabled: bool) -> Self
pub fn mock_mode(self, enabled: bool) -> Self
Set “mock mode” which, if set to true, will log print the email instead of sending it.
Sourcepub async fn build(self) -> Result<GmailClient>
pub async fn build(self) -> Result<GmailClient>
Build a GmailClient
from this GmailClientBuilder
.
Note: This function will retrieve an access token from the Google API and as such make an API request.
Trait Implementations§
Source§impl Clone for GmailClientBuilder
impl Clone for GmailClientBuilder
Source§fn clone(&self) -> GmailClientBuilder
fn clone(&self) -> GmailClientBuilder
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for GmailClientBuilder
impl RefUnwindSafe for GmailClientBuilder
impl Send for GmailClientBuilder
impl Sync for GmailClientBuilder
impl Unpin for GmailClientBuilder
impl UnwindSafe for GmailClientBuilder
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