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

#9 in #tools

Download history 251/week @ 2024-11-27 169/week @ 2024-12-04 159/week @ 2024-12-11 114/week @ 2024-12-18 36/week @ 2024-12-25 126/week @ 2025-01-01 122/week @ 2025-01-08 155/week @ 2025-01-15 265/week @ 2025-01-22 153/week @ 2025-01-29 107/week @ 2025-02-05 116/week @ 2025-02-12 67/week @ 2025-02-19 87/week @ 2025-02-26 107/week @ 2025-03-05 150/week @ 2025-03-12

448 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–16MB
~210K SLoC