mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Add _unguarded to RawLua::app_data_ref (for internal use only)
This commit is contained in:
+2
-2
@@ -481,7 +481,7 @@ impl<'a> Chunk<'a> {
|
||||
if let Ok(ref source) = self.source {
|
||||
if self.detect_mode() == ChunkMode::Text {
|
||||
let lua = self.lua.lock();
|
||||
if let Some(cache) = lua.app_data_ref::<ChunksCache>() {
|
||||
if let Some(cache) = lua.app_data_ref_unguarded::<ChunksCache>() {
|
||||
if let Some(data) = cache.0.get(source.as_ref()) {
|
||||
self.source = Ok(Cow::Owned(data.clone()));
|
||||
self.mode = Some(ChunkMode::Binary);
|
||||
@@ -498,7 +498,7 @@ impl<'a> Chunk<'a> {
|
||||
if let Ok(ref binary_source) = self.source {
|
||||
if self.detect_mode() == ChunkMode::Binary {
|
||||
let lua = self.lua.lock();
|
||||
if let Some(mut cache) = lua.app_data_mut::<ChunksCache>() {
|
||||
if let Some(mut cache) = lua.app_data_mut_unguarded::<ChunksCache>() {
|
||||
cache.0.insert(text_source, binary_source.as_ref().to_vec());
|
||||
} else {
|
||||
let mut cache = ChunksCache(HashMap::new());
|
||||
|
||||
+2
-2
@@ -285,7 +285,7 @@ impl RawLua {
|
||||
/// See [`Lua::app_data_ref`]
|
||||
#[track_caller]
|
||||
#[inline]
|
||||
pub(crate) fn app_data_ref<T: 'static>(&self) -> Option<AppDataRef<T>> {
|
||||
pub(crate) fn app_data_ref_unguarded<T: 'static>(&self) -> Option<AppDataRef<T>> {
|
||||
let extra = unsafe { &*self.extra.get() };
|
||||
extra.app_data.borrow(None)
|
||||
}
|
||||
@@ -293,7 +293,7 @@ impl RawLua {
|
||||
/// See [`Lua::app_data_mut`]
|
||||
#[track_caller]
|
||||
#[inline]
|
||||
pub(crate) fn app_data_mut<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
|
||||
pub(crate) fn app_data_mut_unguarded<T: 'static>(&self) -> Option<AppDataRefMut<T>> {
|
||||
let extra = unsafe { &*self.extra.get() };
|
||||
extra.app_data.borrow_mut(None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user