fixed_len_str 0.2.5

A procedural macro for create a smart pointer to str backed by a fixed size array,with the size given by the tokens.
Documentation
# fixed_len_str


This Rust library provides a procedural macro for declare a wrapper struct for an array with the size given by the tokens which dereferences to [`str`] and a macro for create they from [`str`].

For a proper API documentation of one of length 12 see [fixed_len_str_example].

If you want to use [serde] to serialize and deserialize the fixed_len_str use the `serde_support` feature and if you want the documentation visible at the expansion use `default-features = false`.

# Usage


```rust
use fixed_len_str::fixed_len_str;

fixed_len_str!(3);

fn main() {
    let string = FixedStr3::from("abc");
    
    assert_eq!(string, "abc");
    
    let string = unsafe { FixedStr3::new_unchecked(*b"abc") };
    
    assert_eq!(string, "abc");
    
    let mut string = FixedStr3::default(); // equivalent to mem::zeroed but safe
    string.fill_str("abc");
    
    assert_eq!(string, "abc");
    
    let mut string = unsafe { FixedStr3::new_unchecked([b'a', b'b', 0]) };
    assert_eq!(string, "ab");
    string.fill_char('c');
    
    assert_eq!(string, "abc");
    assert_eq!(string.as_bytes(), string.as_ref().as_bytes()); // this is only certain with non-zero bytes
    assert_eq!(string.clone().into_string(), String::from(string.as_ref())); // clone or consume at your option
    assert_eq!(FixedStr3::from(Vec::new()).as_ref(), "");
}
```

[`str`]: https://doc.rust-lang.org/std/primitive.str.html
[fixed_len_str_example]: https://docs.rs/fixed_len_str_example/
[serde]: https://crates.io/crates/serde