Skip to main content

view_is

Function view_is 

Source
pub fn view_is(view: &ViewHandle, mangled: &str) -> bool
Expand description

Is the view a T, where T is named by its mangled type?

The question a ViewHandle makes askable: it carries its own metadata, so “did that modifier really build a ModifiedContent?” is answerable at run time. dynamic_type_name gives the same information as a string; this gives it as a decision, and without parsing.

let t = views::text("hi");
assert!(runtime::view_is(&t, &mangle::nominal(&["SwiftUI", "Text"], mangle::Kind::Struct)));