anythingy 0.1.2

A library for dynamic typing.
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented1 out of 1 items with examples
  • Size
  • Source code size: 57.17 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.85 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • wutterfly/anythingy
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wutterfly

Anythingy

Rust

This is a work-in-progess project and not for production use.

Thingy: a [..] thing whose name one has forgotten, does not know, or does not wish to mention. [from Oxford Languages]

A library for dynamic typing. It's main feature is the Thing type, that works similar to Box<dyn Any>, but can be sized at compile time while falling back to boxing the value, if it's too big.

Example

use anything::Thing;
fn main() {
    let number_thing: Thing<24> = Thing::new(42u64);
    let string_thing: Thing<24> = Thing::new(String::from("Hello there"));
    let bytes_thing: Thing<24> = Thing::new(Vec::from(b"so uncivilized"));

    let number = number_thing.get::<u64>();
    assert_eq!(number, 42);

    let string = string_thing.get::<String>();
    assert_eq!(&string, "Hello there");

    let bytes = bytes_thing.get::<Vec<u8>>();
    assert_eq!(&bytes, b"so uncivilized");
  }

Licence

This project is licensed under the MIT license.