pub struct MemoryClient { /* private fields */ }memory only.Implementations§
Source§impl MemoryClient
impl MemoryClient
Sourcepub fn new(config: MemoryConfig) -> Self
pub fn new(config: MemoryConfig) -> Self
Initializes a new MemoryClient with the provided MemoryConfig.
§Parameters
config: AMemoryConfiginstance that will be used to initialize theMemoryClient.
§Returns
A new instance of MemoryClient with the sender and SyncSender<EmailObject> set per the provided MemoryConfig.
§Examples
let config = MemoryConfig::new("sender@example.com");
let client = MemoryClient::new(config);
assert_eq!(client.get_sender().to_string(), "sender@example.com");Sourcepub fn with_tx(config: MemoryConfig, tx: SyncSender<EmailObject>) -> Self
pub fn with_tx(config: MemoryConfig, tx: SyncSender<EmailObject>) -> Self
Initializes a new MemoryClient with the provided MemoryConfig and SyncSender<EmailObject>.
§Parameters
config: AMemoryConfiginstance that will be used to initialize theMemoryClient.tx: ASyncSender<EmailObject>instance that will be used for sending emails.
§Returns
A new instance of MemoryClient with the sender and SyncSender<EmailObject> set per the provided parameters.
§Examples
let config = MemoryConfig::new("sender@example.com");
let (tx, rx) = sync_channel(2);
let client = MemoryClient::with_tx(config, tx.clone());
assert_eq!(client.get_sender().to_string(), "sender@example.com");Trait Implementations§
Source§impl Clone for MemoryClient
impl Clone for MemoryClient
Source§fn clone(&self) -> MemoryClient
fn clone(&self) -> MemoryClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryClient
impl Debug for MemoryClient
Source§impl Default for MemoryClient
impl Default for MemoryClient
Source§fn default() -> Self
fn default() -> Self
Default implementation for MemoryClient.
This method will return a MemoryClient instance with an empty sender and a SyncSender<EmailObject>
with a channel buffer size of 5.
§Returns
A MemoryClient instance with the default configuration.
§Examples
use email_clients::clients::memory::MemoryClient;
use email_clients::traits::EmailTrait;
let default_client = MemoryClient::default();
// Gets the default sender which is an empty string
assert_eq!(default_client.get_sender().to_string(), "");Source§impl EmailTrait for MemoryClient
impl EmailTrait for MemoryClient
Source§fn get_sender(&self) -> EmailAddress
fn get_sender(&self) -> EmailAddress
Returns the sender email address used for the MemoryClient.
§Returns
An EmailAddress that is used as the sender’s email in the MemoryClient.
§Examples
let config = MemoryConfig::new("sender@example.com");
let client = MemoryClient::new(config);
assert_eq!(client.get_sender().to_string(), "sender@example.com");Source§fn send_emails<'life0, 'async_trait>(
&'life0 self,
email: EmailObject,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_emails<'life0, 'async_trait>(
&'life0 self,
email: EmailObject,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends email from memory client.