pub struct FakeApiResponse<T> { /* private fields */ }Expand description
Builder for a fake ApiResponse<T>.
§Quick start
use api_bones_test::builders::FakeApiResponse;
let resp = FakeApiResponse::new("hello").build();
assert_eq!(resp.data, "hello");
assert!(resp.meta.request_id.is_some());
assert!(resp.meta.timestamp.is_some());Implementations§
Source§impl<T> FakeApiResponse<T>
impl<T> FakeApiResponse<T>
pub fn new(data: T) -> Self
pub fn with_meta(self, meta: ResponseMeta) -> Self
pub fn with_links(self, links: Links) -> Self
pub fn with_request_id(self, id: impl Into<String>) -> Self
pub fn build(self) -> ApiResponse<T>
Auto Trait Implementations§
impl<T> Freeze for FakeApiResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for FakeApiResponse<T>where
T: RefUnwindSafe,
impl<T> Send for FakeApiResponse<T>where
T: Send,
impl<T> Sync for FakeApiResponse<T>where
T: Sync,
impl<T> Unpin for FakeApiResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for FakeApiResponse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for FakeApiResponse<T>where
T: UnwindSafe,
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