pub struct ExpectFloat { /* private fields */ }Implementations§
Source§impl ExpectFloat
impl ExpectFloat
Sourcepub fn in_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f64>,
pub fn in_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f64>,
Expect the float found to be within the given range.
use axum_test::expect_json;
let server = TestServer::new(Router::new())?;
server.get(&"/user/barrington")
.await
.assert_json(&json!({
"name": "Barrington",
"height_in_meters": expect_json::float().in_range(0.5..=2.5),
}));pub fn outside_range<R>(self, range: R) -> Selfwhere
R: RangeBounds<f64>,
pub fn zero(self) -> Self
pub fn not_zero(self) -> Self
pub fn positive(self) -> Self
pub fn negative(self) -> Self
Trait Implementations§
Source§impl Clone for ExpectFloat
impl Clone for ExpectFloat
Source§fn clone(&self) -> ExpectFloat
fn clone(&self) -> ExpectFloat
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 ExpectFloat
impl Debug for ExpectFloat
Source§impl Default for ExpectFloat
impl Default for ExpectFloat
Source§fn default() -> ExpectFloat
fn default() -> ExpectFloat
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ExpectFloat
impl<'de> Deserialize<'de> for ExpectFloat
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 ExpectFloat
impl ExpectOp for ExpectFloat
fn on_f64(&self, context: &mut Context<'_>, received: f64) -> 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_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_string( &self, context: &mut Context<'_>, received: &str, ) -> 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<ExpectFloat> for Value
impl From<ExpectFloat> for Value
Source§fn from(value: ExpectFloat) -> Self
fn from(value: ExpectFloat) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ExpectFloat
impl PartialEq for ExpectFloat
Source§impl Serialize for ExpectFloat
impl Serialize for ExpectFloat
impl StructuralPartialEq for ExpectFloat
Auto Trait Implementations§
impl Freeze for ExpectFloat
impl RefUnwindSafe for ExpectFloat
impl Send for ExpectFloat
impl Sync for ExpectFloat
impl Unpin for ExpectFloat
impl UnwindSafe for ExpectFloat
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