static-list 0.1.0

Statically defined lists which may contain mixed-typed data and may be iterated (yielding &dyn Trait refs)
Documentation
  • Coverage
  • 0%
    0 out of 11 items documented0 out of 6 items with examples
  • Size
  • Source code size: 15.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.72 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andreytkachenko

Static list

Statically defined lists which may contain mixed type data and may be iterated (yielding &dyn Trait refs)

Basic usage example

use static_list::*;
use std::marker::PhantomData;
use std::fmt::Debug;


#[derive(Debug)]
struct Person {
    name: String,
    age: u32
}

struct Demo<'a> {
    pub t: static_list_type![&'a Debug; u8, &'static str, [u32; 4], Person],
    _m: PhantomData<&'a u32>
}

impl <'a> Demo<'a> {
    pub fn new() -> Self {
        Self {
            t: static_list![1, "It is a string", [1,2,3,4], Person { name: "Andrey".into(), age: 30 }],
            _m: Default::default(),
        }
    }
}

fn main() {
    let demo = Demo::new();

    println!("{:?}", demo.t.iter().collect::<Vec<_>>());
}

nightly required because used std::marker::Unsize from unsize feature