Rename Error::MemoryLimitNotAvailable to Error::MemoryControlNotAvailable

This commit is contained in:
Alex Orlenko
2024-10-22 22:44:52 +01:00
parent 3dc58cdfc9
commit 0d31a1caa6
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -42,11 +42,11 @@ pub enum Error {
GarbageCollectorError(StdString),
/// Potentially unsafe action in safe mode.
SafetyError(StdString),
/// Setting memory limit is not available.
/// Memory control is not available.
///
/// This error can only happen when Lua state was not created by us and does not have the
/// custom allocator attached.
MemoryLimitNotAvailable,
MemoryControlNotAvailable,
/// A mutable callback has triggered Lua code that has called the same mutable callback again.
///
/// This is an error because a mutable callback can only be borrowed mutably once.
@@ -220,8 +220,8 @@ impl fmt::Display for Error {
Error::SafetyError(msg) => {
write!(fmt, "safety error: {msg}")
},
Error::MemoryLimitNotAvailable => {
write!(fmt, "setting memory limit is not available")
Error::MemoryControlNotAvailable => {
write!(fmt, "memory control is not available")
}
Error::RecursiveMutCallback => write!(fmt, "mutable callback called recursively"),
Error::CallbackDestructed => write!(
+1 -1
View File
@@ -792,7 +792,7 @@ impl Lua {
unsafe {
match MemoryState::get(lua.main_state) {
mem_state if !mem_state.is_null() => Ok((*mem_state).set_memory_limit(limit)),
_ => Err(Error::MemoryLimitNotAvailable),
_ => Err(Error::MemoryControlNotAvailable),
}
}
}