私はこのようなことをしようとしています
use std::cell::{RefCell,Ref,RefMut};
use std::rc::Rc;
struct Entity;
struct Tile {
entity: Option<Rc<RefCell<Entity>>>
}
impl Tile {
pub fn try_read_entity<'a>(&'a self) -> Option<Ref<'a, Entity>> {
self.entity.map(|e| e.borrow())
}
}
ライフタイム関連のエラーが発生し、正確に何が問題なのか、またはこれを行うことが可能かどうかを理解するのが難しいと感じています.