pub struct Data { /* private fields */ }Expand description
Test fixture, actual output, or expected result
This provides conveniences for tracking the intended format (binary vs text).
Implementations§
source§impl Data
impl Data
pub fn json(raw: impl Into<Value>) -> Self
Available on crate feature
json only.sourcepub fn read_from(
path: &Path,
data_format: Option<DataFormat>
) -> Result<Self, Error>
pub fn read_from( path: &Path, data_format: Option<DataFormat> ) -> Result<Self, Error>
Load test data from a file
sourcepub fn render(&self) -> Option<String>
pub fn render(&self) -> Option<String>
Return the underlying String
Note: this will not inspect binary data for being a valid String.
pub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn try_coerce(self, format: DataFormat) -> Self
sourcepub fn format(&self) -> DataFormat
pub fn format(&self) -> DataFormat
Outputs the current DataFormat of the underlying data
Trait Implementations§
source§impl PartialEq for Data
impl PartialEq for Data
impl Eq for Data
impl StructuralEq for Data
impl StructuralPartialEq for Data
Auto Trait Implementations§
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
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