5 releases

0.2.3 Feb 12, 2024
0.2.2 Dec 20, 2023
0.2.1 Dec 12, 2023
0.2.0 Dec 12, 2023
0.1.0 Dec 12, 2023

#2073 in Web programming

Download history 73/week @ 2024-01-02 192/week @ 2024-01-09 124/week @ 2024-01-16 284/week @ 2024-01-23 218/week @ 2024-01-30 300/week @ 2024-02-06 331/week @ 2024-02-13 208/week @ 2024-02-20 388/week @ 2024-02-27 337/week @ 2024-03-05 154/week @ 2024-03-12 105/week @ 2024-03-19 20/week @ 2024-03-26 210/week @ 2024-04-02 243/week @ 2024-04-09 409/week @ 2024-04-16

884 downloads per month
Used in patternfly-yew

Apache-2.0

10KB
186 lines

web-tools

crates.io docs.rs

Tools for the Web

Usage

Add it to your project:

cargo add web-tools

Rationale

Rust has a strict type system, which is great. But sometimes it's just convenient to use:

use web_tools::prelude::*;

fn callback(node: &NodeRef) {
    node.focus();
}

Functionality

  • Optimistic traits: execute some function on an element, if it supports it … or do nothing.
  • Iterators for things that should be iterable, but don't implement IntoIterator.

lib.rs:

web-tools

Tools for web programming in Rust.

Rationale

Rust has a strict type system, which is great. But sometimes it's just convenient to use:

use web_tools::prelude::*;

#[cfg(feature = "yew")]
fn yew(node: &yew::prelude::NodeRef) {
    node.focus();
}

fn vanilla(element: &web_sys::Element) {
    element.focus();
}

Functionality

  • Optimistic traits: execute some function on an element, if it supports it … or do nothing.
  • Iterators for things that should be iterable, but don't implement IntoIterator.

Dependencies

~7–10MB
~198K SLoC