Struct DecoderHarness

Source
pub struct DecoderHarness<D> { /* private fields */ }
Expand description

Run decoder compliance tests

§Example

In Cargo.toml:

[[test]]
name = "decoder_compliance"
harness = false

tests/decoder_compliance.rs

// mod decoder;

fn main() {
    let decoder = decoder::Decoder;
    let mut harness = toml_test_harness::DecoderHarness::new(decoder);
    harness.version("1.0.0");
    harness.ignore([]).unwrap();
    harness.test();
}

Implementations§

Source§

impl<D> DecoderHarness<D>
where D: Decoder + Copy + Send + Sync + 'static,

Source

pub fn new(decoder: D) -> Self

Source

pub fn ignore<'p>( &mut self, patterns: impl IntoIterator<Item = &'p str>, ) -> Result<&mut Self, Error>

Source

pub fn version(&mut self, version: impl Into<String>) -> &mut Self

Source

pub fn extend_valid( &mut self, cases: impl IntoIterator<Item = Valid<'static>>, ) -> &mut Self

Source

pub fn extend_invalid( &mut self, cases: impl IntoIterator<Item = Invalid<'static>>, ) -> &mut Self

Source

pub fn snapshot_root(&mut self, root: impl Into<PathBuf>) -> &mut Self

Available on crate feature snapshot only.
Source

pub fn test(self) -> !

Auto Trait Implementations§

§

impl<D> Freeze for DecoderHarness<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for DecoderHarness<D>
where D: RefUnwindSafe,

§

impl<D> Send for DecoderHarness<D>
where D: Send,

§

impl<D> Sync for DecoderHarness<D>
where D: Sync,

§

impl<D> Unpin for DecoderHarness<D>
where D: Unpin,

§

impl<D> UnwindSafe for DecoderHarness<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.