pub struct ExpectEmail { /* private fields */ }Expand description
Expects a valid email address string.
You can build these using the crate::expect::email function.
Implementations§
Source§impl ExpectEmail
impl ExpectEmail
Sourcepub fn local_part<S>(self, local_part: S) -> Self
pub fn local_part<S>(self, local_part: S) -> Self
Expects the local part of the email address. The ‘local part’ is the part before the ‘@’ symbol. i.e. the ‘joe’ in ‘joe@example.com’.
use axum_test::expect_json;
let server = TestServer::new(Router::new())?;
server.get(&"/user")
.await
.assert_json(&json!({
"name": "Joe",
"email": expect_json::email().local_part("joe"),
}));Sourcepub fn domain<S>(self, domain: S) -> Self
pub fn domain<S>(self, domain: S) -> Self
Expects the domain part of the email address. i.e. ‘example.com’ in ‘joe@example.com’.
use axum_test::expect_json;
let server = TestServer::new(Router::new())?;
server.get(&"/user")
.await
.assert_json(&json!({
"name": "Joe",
"email": expect_json::email().domain("example.com"),
}));Trait Implementations§
Source§impl Clone for ExpectEmail
impl Clone for ExpectEmail
Source§fn clone(&self) -> ExpectEmail
fn clone(&self) -> ExpectEmail
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 moreSource§impl Debug for ExpectEmail
impl Debug for ExpectEmail
Source§impl Default for ExpectEmail
impl Default for ExpectEmail
Source§fn default() -> ExpectEmail
fn default() -> ExpectEmail
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ExpectEmail
impl<'de> Deserialize<'de> for ExpectEmail
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ExpectOp for ExpectEmail
impl ExpectOp for ExpectEmail
fn on_string( &self, context: &mut Context<'_>, received: &str, ) -> ExpectOpResult<()>
Source§fn debug_supported_types(&self) -> &'static [JsonType]
fn debug_supported_types(&self) -> &'static [JsonType]
This is optional to implement. This method returns a list of types this is targeting. Read more
fn on_any( &self, context: &mut Context<'_>, received: &Value, ) -> ExpectOpResult<()>
fn on_null(&self, context: &mut Context<'_>) -> ExpectOpResult<()>
fn on_f64(&self, context: &mut Context<'_>, received: f64) -> ExpectOpResult<()>
fn on_u64(&self, context: &mut Context<'_>, received: u64) -> ExpectOpResult<()>
fn on_i64(&self, context: &mut Context<'_>, received: i64) -> ExpectOpResult<()>
fn on_boolean( &self, context: &mut Context<'_>, received: bool, ) -> ExpectOpResult<()>
fn on_array( &self, context: &mut Context<'_>, received: &[Value], ) -> ExpectOpResult<()>
fn on_object( &self, context: &mut Context<'_>, received: &Map<String, Value>, ) -> ExpectOpResult<()>
Source§impl From<ExpectEmail> for Value
impl From<ExpectEmail> for Value
Source§fn from(value: ExpectEmail) -> Self
fn from(value: ExpectEmail) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ExpectEmail
impl PartialEq for ExpectEmail
Source§impl Serialize for ExpectEmail
impl Serialize for ExpectEmail
impl StructuralPartialEq for ExpectEmail
Auto Trait Implementations§
impl Freeze for ExpectEmail
impl RefUnwindSafe for ExpectEmail
impl Send for ExpectEmail
impl Sync for ExpectEmail
impl Unpin for ExpectEmail
impl UnwindSafe for ExpectEmail
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