Statue

Easier way to querry selectors for static HTML pages.

Crates.io Docs.rs License

Spare yourself from writing

```rust let workarea = document .queryselector("#work-area") .unwrap() .unwrap() .dyn_into::() .unwrap();

let layerlistdiv = document .queryselector("#layer-list") .unwrap() .unwrap() .dyninto::() .unwrap();

let savefilesbtn = document .queryselector("#save-files") .unwrap() .unwrap() .dyninto::() .unwrap(); ```

and write

rust initialize_elements!( html: "index.html", elements: { let work_area = Single("#work-area"); let layer_list_div = Single("#layer-list"); let save_files_btn = Single("#save-files"); } );

instead.

Note on optimization

Eventually, this can be possible to just traverse the tree of HTML nodes to get the elements chosen by selectors. However, this is not implemented yet.

Note on (in-)completeness of implementation

The implementation is incomplete. For example, many elements of [web_sys] are not yet supported. One easy way to add support for more elements is to edit src/elements.rs and add the element to the ElementKind enum. Then, edit new method of ElementKind to return the element kind you added. Finally, edit to_web_sys_name.

File structure

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.