Skip to content

Commit 640cb2c

Browse files
committed
Add _unguarded to RawLua::app_data_ref (for internal use only)
1 parent 03a4068 commit 640cb2c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/chunk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl<'a> Chunk<'a> {
481481
if let Ok(ref source) = self.source {
482482
if self.detect_mode() == ChunkMode::Text {
483483
let lua = self.lua.lock();
484-
if let Some(cache) = lua.app_data_ref::<ChunksCache>() {
484+
if let Some(cache) = lua.app_data_ref_unguarded::<ChunksCache>() {
485485
if let Some(data) = cache.0.get(source.as_ref()) {
486486
self.source = Ok(Cow::Owned(data.clone()));
487487
self.mode = Some(ChunkMode::Binary);
@@ -498,7 +498,7 @@ impl<'a> Chunk<'a> {
498498
if let Ok(ref binary_source) = self.source {
499499
if self.detect_mode() == ChunkMode::Binary {
500500
let lua = self.lua.lock();
501-
if let Some(mut cache) = lua.app_data_mut::<ChunksCache>() {
501+
if let Some(mut cache) = lua.app_data_mut_unguarded::<ChunksCache>() {
502502
cache.0.insert(text_source, binary_source.as_ref().to_vec());
503503
} else {
504504
let mut cache = ChunksCache(HashMap::new());

src/state/raw.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,15 @@ impl RawLua {
285285
/// See [`Lua::app_data_ref`]
286286
#[track_caller]
287287
#[inline]
288-
pub(crate) fn app_data_ref<T: 'static>(&self) -> Option<AppDataRef<T>> {
288+
pub(crate) fn app_data_ref_unguarded<T: 'static>(&self) -> Option<AppDataRef<T>> {
289289
let extra = unsafe { &*self.extra.get() };
290290
extra.app_data.borrow(None)
291291
}
292292

293293
/// See [`Lua::app_data_mut`]
294294
#[track_caller]
295295
#[inline]
296-
pub(crate) fn app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
296+
pub(crate) fn app_data_mut_unguarded<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
297297
let extra = unsafe { &*self.extra.get() };
298298
extra.app_data.borrow_mut(None)
299299
}

0 commit comments

Comments
 (0)