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
sourceimpl 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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
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
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
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
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.