Skip to main content

FailureInit

Struct FailureInit 

Source
pub struct FailureInit {
    pub code: Option<FailureCode>,
    pub message: String,
    pub selector: Option<Selector>,
    pub suggestions: Vec<String>,
    pub visible_elements: Vec<ElementSummary>,
    pub hint: Option<String>,
    pub screenshot: Option<String>,
    pub device_log: Vec<String>,
    pub visible_total: Option<usize>,
    pub windows: Vec<WindowInfo>,
    pub unreadable_windows: Option<u32>,
}
Expand description

Builder/Init form for ergonomic construction.

Fields§

§code: Option<FailureCode>

Optional failure code (defaults to DriverError if None).

§message: String

Human-readable / AI-readable message.

§selector: Option<Selector>

Originating selector, when one is available.

§suggestions: Vec<String>

Pre-built ranked near-miss suggestions.

§visible_elements: Vec<ElementSummary>

Captured visible+enabled elements at failure time.

§hint: Option<String>

Optional one-line hint string.

§screenshot: Option<String>

Optional base64 PNG screenshot at failure time.

§device_log: Vec<String>

Optional captured device log tail.

§visible_total: Option<usize>§windows: Vec<WindowInfo>§unreadable_windows: Option<u32>

Implementations§

Source§

impl FailureInit

Source

pub fn with_screen(self, facts: ScreenFacts) -> Self

The screen the failure happened on: its elements (already in the order a reader should meet them), how many there were, whose windows they sat in, and how many windows could not be read.

One entry point, so a call site cannot hand over the list and forget the count that says it is a sample.

Source

pub fn with_screen_from(self, earlier: &ExpectationFailure) -> Self

The screen an earlier failure described, carried into a new one.

For a failure that re-states another (a timeout reported as “not visible”): copying visible_elements by hand left the count and the windows behind, and the next field added would be left behind the same way.

Trait Implementations§

Source§

impl Default for FailureInit

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.