Struct poem::test::TestJsonArray
source · [−]pub struct TestJsonArray<'a>(_);
Available on crate feature
test
only.Expand description
A JSON array.
Implementations
sourceimpl<'a> TestJsonArray<'a>
impl<'a> TestJsonArray<'a>
sourcepub fn get(&self, idx: usize) -> TestJsonValue<'a>
pub fn get(&self, idx: usize) -> TestJsonValue<'a>
Returns the element at index idx
.
sourcepub fn get_opt(&self, idx: usize) -> Option<TestJsonValue<'a>>
pub fn get_opt(&self, idx: usize) -> Option<TestJsonValue<'a>>
Returns the element at index idx
, or None
if the element does not
exists exists.
sourcepub fn iter(&self) -> impl Iterator<Item = TestJsonValue<'a>>
pub fn iter(&self) -> impl Iterator<Item = TestJsonValue<'a>>
Returns an iterator over the array.
sourcepub fn assert_len(&self, len: usize)
pub fn assert_len(&self, len: usize)
Asserts the array length is equals to len
.
sourcepub fn assert_is_empty(&self)
pub fn assert_is_empty(&self)
Asserts the array is empty.
sourcepub fn assert_contains(&self, f: impl FnMut(TestJsonValue<'_>) -> bool)
pub fn assert_contains(&self, f: impl FnMut(TestJsonValue<'_>) -> bool)
Asserts the array contains values that satisfies a predicate.
sourcepub fn assert_contains_exactly_one(&self, f: impl Fn(TestJsonValue<'_>) -> bool)
pub fn assert_contains_exactly_one(&self, f: impl Fn(TestJsonValue<'_>) -> bool)
Asserts the array contains exactly one value that satisfies a predicate.
Trait Implementations
sourceimpl<'a> Clone for TestJsonArray<'a>
impl<'a> Clone for TestJsonArray<'a>
sourcefn clone(&self) -> TestJsonArray<'a>
fn clone(&self) -> TestJsonArray<'a>
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'a> Debug for TestJsonArray<'a>
impl<'a> Debug for TestJsonArray<'a>
sourceimpl<'a, T> PartialEq<T> for TestJsonArray<'a>where
T: AsRef<[Value]>,
impl<'a, T> PartialEq<T> for TestJsonArray<'a>where
T: AsRef<[Value]>,
impl<'a> Copy for TestJsonArray<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for TestJsonArray<'a>
impl<'a> Send for TestJsonArray<'a>
impl<'a> Sync for TestJsonArray<'a>
impl<'a> Unpin for TestJsonArray<'a>
impl<'a> UnwindSafe for TestJsonArray<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more