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
§Constructors
See also
impl Data
§Constructors
See also
Source§impl Data
§Assertion frameworks operations
For example, see OutputAssert
impl Data
§Assertion frameworks operations
For example, see OutputAssert
Sourcepub fn try_read_from(
path: &Path,
data_format: Option<DataFormat>,
) -> Result<Data, Error>
pub fn try_read_from( path: &Path, data_format: Option<DataFormat>, ) -> Result<Data, Error>
Load expected 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) -> Result<Vec<u8>, Error>
Sourcepub fn is(self, format: DataFormat) -> Data
pub fn is(self, format: DataFormat) -> Data
Sourcepub fn coerce_to(self, format: DataFormat) -> Data
pub fn coerce_to(self, format: DataFormat) -> Data
Convert Self to format if possible
This is generally used on actual data to make it match expected
Sourcepub fn source(&self) -> Option<&DataSource>
pub fn source(&self) -> Option<&DataSource>
Location the data came from
Sourcepub fn format(&self) -> DataFormat
pub fn format(&self) -> DataFormat
Outputs the current DataFormat of the underlying data
Trait Implementations§
impl Eq for Data
Auto Trait Implementations§
impl Freeze for Data
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