1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#[macro_use] mod object; mod args; mod containers; mod tuple; pub use self::args::*; pub use self::containers::*; pub use self::object::*; pub use self::tuple::*; use std::{ fmt::{self, Display}, os::raw::c_char, }; #[derive(Debug, Clone, PartialEq, Eq)] pub struct AttrStr(String); impl AttrStr { pub fn new(s: &str) -> Self { Self(format!("{}\0", s)) } pub fn as_ptr(&self) -> *mut c_char { self.0.as_ptr() as *mut c_char } } impl Display for AttrStr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(&self.0, f) } }