Struct goose_eggs::Validate[][src]

pub struct Validate<'a> {
    pub status: Option<u16>,
    pub title: Option<&'a str>,
    pub texts: Vec<&'a str>,
}
Expand description

Define one or more items to be validated in a web page response.

This structure is passed to validate_and_load_static_assets.

Example

use goose_eggs::Validate;

fn example() {
    let _validate = Validate {
        // Don't do any extra validation of the status code.
        status: None,
        // Be sure the expected title is on the page.
        title: Some("my page"),
        // Be sure both of the following strings are found on the page.
        texts: vec!["foo", r#"<a href="bar">"#],
    };
}

Fields

status: Option<u16>

If provided, validate the response status code.

title: Option<&'a str>

If provided, validate the response title.

texts: Vec<&'a str>

If provided, validate that the provided texts are found on the page.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.