Implement/Derive `Debug` for Lua and few other structs
This commit is contained in:
parent
108682cc71
commit
64346ce56c
10
src/lua.rs
10
src/lua.rs
|
@ -2,6 +2,7 @@ use std::any::TypeId;
|
||||||
use std::cell::{RefCell, UnsafeCell};
|
use std::cell::{RefCell, UnsafeCell};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::os::raw::{c_char, c_int, c_void};
|
use std::os::raw::{c_char, c_int, c_void};
|
||||||
use std::panic::resume_unwind;
|
use std::panic::resume_unwind;
|
||||||
|
@ -88,6 +89,7 @@ struct MemoryInfo {
|
||||||
/// More information can be found in the Lua 5.x [documentation].
|
/// More information can be found in the Lua 5.x [documentation].
|
||||||
///
|
///
|
||||||
/// [documentation]: https://www.lua.org/manual/5.4/manual.html#2.5
|
/// [documentation]: https://www.lua.org/manual/5.4/manual.html#2.5
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum GCMode {
|
pub enum GCMode {
|
||||||
Incremental,
|
Incremental,
|
||||||
/// Requires `feature = "lua54"`
|
/// Requires `feature = "lua54"`
|
||||||
|
@ -128,6 +130,12 @@ impl Drop for Lua {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Lua {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "Lua({:p})", self.state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Lua {
|
impl Lua {
|
||||||
/// Creates a new Lua state and loads the **safe** subset of the standard libraries.
|
/// Creates a new Lua state and loads the **safe** subset of the standard libraries.
|
||||||
///
|
///
|
||||||
|
@ -1942,7 +1950,7 @@ pub struct Chunk<'lua, 'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents chunk mode (text or binary).
|
/// Represents chunk mode (text or binary).
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum ChunkMode {
|
pub enum ChunkMode {
|
||||||
Text,
|
Text,
|
||||||
Binary,
|
Binary,
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::table::{TablePairs, TableSequence};
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
/// A struct for deserializing Lua values into Rust values.
|
/// A struct for deserializing Lua values into Rust values.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Deserializer<'lua>(Value<'lua>);
|
pub struct Deserializer<'lua>(Value<'lua>);
|
||||||
|
|
||||||
impl<'lua> Deserializer<'lua> {
|
impl<'lua> Deserializer<'lua> {
|
||||||
|
|
|
@ -13,6 +13,7 @@ use crate::util::{check_stack, StackGuard};
|
||||||
use crate::value::{ToLua, Value};
|
use crate::value::{ToLua, Value};
|
||||||
|
|
||||||
/// A struct for serializing Rust values into Lua values.
|
/// A struct for serializing Rust values into Lua values.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Serializer<'lua> {
|
pub struct Serializer<'lua> {
|
||||||
lua: &'lua Lua,
|
lua: &'lua Lua,
|
||||||
options: Options,
|
options: Options,
|
||||||
|
|
Loading…
Reference in New Issue