pub struct BinaryResponse {
pub binary_data: Option<String>,
pub delay: Option<Delay>,
}Expand description
Builder for a raw binary response action.
Serialized as the binaryResponse action in an expectation. The binary
payload is base64-encoded on the wire (the schema declares binaryData
as a string).
§Example
use mockserver_client::BinaryResponse;
let resp = BinaryResponse::from_bytes([0xDE, 0xAD, 0xBE, 0xEF]);Fields§
§binary_data: Option<String>§delay: Option<Delay>Implementations§
Source§impl BinaryResponse
impl BinaryResponse
Sourcepub fn from_bytes(data: impl AsRef<[u8]>) -> Self
pub fn from_bytes(data: impl AsRef<[u8]>) -> Self
Create a binary response from raw bytes (base64-encoded on the wire).
Sourcepub fn from_base64(base64: impl Into<String>) -> Self
pub fn from_base64(base64: impl Into<String>) -> Self
Create a binary response from an already base64-encoded string.
Sourcepub fn binary_data(self, data: impl AsRef<[u8]>) -> Self
pub fn binary_data(self, data: impl AsRef<[u8]>) -> Self
Set the binary payload from raw bytes (base64-encoded on the wire).
Trait Implementations§
Source§impl Clone for BinaryResponse
impl Clone for BinaryResponse
Source§fn clone(&self) -> BinaryResponse
fn clone(&self) -> BinaryResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BinaryResponse
impl Debug for BinaryResponse
Source§impl Default for BinaryResponse
impl Default for BinaryResponse
Source§fn default() -> BinaryResponse
fn default() -> BinaryResponse
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BinaryResponse
impl<'de> Deserialize<'de> for BinaryResponse
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 PartialEq for BinaryResponse
impl PartialEq for BinaryResponse
Source§fn eq(&self, other: &BinaryResponse) -> bool
fn eq(&self, other: &BinaryResponse) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for BinaryResponse
impl Serialize for BinaryResponse
impl StructuralPartialEq for BinaryResponse
Auto Trait Implementations§
impl Freeze for BinaryResponse
impl RefUnwindSafe for BinaryResponse
impl Send for BinaryResponse
impl Sync for BinaryResponse
impl Unpin for BinaryResponse
impl UnsafeUnpin for BinaryResponse
impl UnwindSafe for BinaryResponse
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