Skip to main content

Probed

Trait Probed 

Source
pub trait Probed:
    IntoElement
    + Styled
    + Sized {
    // Provided method
    fn probe(self, name: impl Into<SharedString>) -> Probe<Self> { ... }
}
Expand description

Tag any element as a component for the Elements panel.

Call it last, on the element a component’s render returns:

impl RenderOnce for Button {
    fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
        div()
            // ...
            .probe("Button")
            .attr("variant", self.variant.label())
    }
}

The bound is Styled rather than plain IntoElement so the probe can snapshot the element’s style on the way past — that snapshot is the whole Styles and Computed sidebar. Every component root is a styled element, so in practice this costs nothing.

Provided Methods§

Source

fn probe(self, name: impl Into<SharedString>) -> Probe<Self>

Wrap this element in a probe named name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§