[][src]Macro fixed_len_str::fixed_len_str

fixed_len_str!() { /* proc-macro */ }

A macro for declare an FixedStrinput struct.

Examples

use fixed_len_str::fixed_len_str;
 
fixed_len_str!(3);
 
fn main() {
    let string = new_str3!("abc");
 
    assert_eq!(string.as_ref(), "abc");
 
    let string = FixedStr3::new(*b"abc");
 
    assert_eq!(string.as_ref(), "abc");
 
    let mut string = FixedStr3::default(); // equivalent to mem::zeroed but safe
    string.fill_zeroes_str("abc");
 
    assert_eq!(string.as_ref(), "abc");
 
    let mut string = FixedStr3::new([b'a', b'b', 0]);
    string.fill_zeroes_char('c');
 
    assert_eq!(string.as_ref(), "abc");
}