66/// Will panic if passed an expression that a CString could not be created from.
77/// # Examples
88/// ```rust
9+ /// use rglua::prelude::*;
910/// let a = b"Hello world!".as_ptr() as *const i8;
1011/// let b = cstr!("Hello world!");
11- /// assert_eq!(*a, *b);
12+ /// unsafe { assert_eq!(*a, *b) } ;
1213/// ```
1314#[ macro_export]
1415macro_rules! cstr {
@@ -26,9 +27,10 @@ macro_rules! cstr {
2627/// or if it is a value, makes a cstring and returns the pointer to it.
2728/// # Examples
2829/// ```rust
30+ /// use rglua::prelude::*;
2931/// let a = b"Hello world!".as_ptr() as *const i8;
3032/// let b = try_cstr!("Hello world!");
31- /// assert_eq!(*a, *b.unwrap()) ;
33+ /// unsafe { assert_eq!(*a, *b) } ;
3234/// ```
3335#[ macro_export]
3436macro_rules! try_cstr {
@@ -45,6 +47,7 @@ macro_rules! try_cstr {
4547/// Will panic if the const char* is not valid utf-8
4648/// # Examples
4749/// ```rust
50+ /// use rglua::prelude::*;
4851/// let cstr = cstr!("Hello World");
4952/// let rust_str = rstr!(cstr);
5053/// assert_eq!(rust_str, "Hello World");
@@ -62,9 +65,10 @@ macro_rules! rstr {
6265/// Tries to convert a const char* to an &str
6366/// # Examples
6467/// ```rust
68+ /// use rglua::prelude::*;
6569/// let cstr = cstr!("Hello World");
6670/// let rstr = try_rstr!(cstr);
67- /// assert(rstr.is_ok()); // Should be perfectly valid to convert to utf8
71+ /// assert! (rstr.is_ok()); // Should be perfectly valid to convert to utf8
6872/// ```
6973macro_rules! try_rstr {
7074 ( $cstring: expr) => { {
@@ -81,7 +85,8 @@ macro_rules! try_rstr {
8185/// Rest are varargs.
8286/// Can be either a variable storing a str literal, or a referenced String / str variable
8387/// # Examples
84- /// ```rust
88+ /// ```ignore
89+ /// use rglua::prelude::*;
8590/// printgm!(state, "Hello {}!", "world");
8691/// ```
8792macro_rules! printgm {
@@ -101,9 +106,12 @@ macro_rules! printgm {
101106/// # Examples
102107/// Basic usage
103108/// ```rust
109+ /// use rglua::prelude::*;
110+ /// extern "C" fn max(l: LuaState) -> i32 { 0 }
111+ /// extern "C" fn min(l: LuaState) -> i32 { 0 }
104112/// let my_library = reg! [
105- /// "max" = max,
106- /// "min" = min,
113+ /// "max" => max,
114+ /// "min" => min
107115/// ];
108116/// ```
109117/// Returns a &[crate::types::LuaReg]
0 commit comments