Skip to content

Instantly share code, notes, and snippets.

View Enprogames's full-sized avatar
🎯
Focusing

Ethan Posner Enprogames

🎯
Focusing
View GitHub Profile
@Enprogames
Enprogames / main.rs
Created January 3, 2025 02:56
Example of Rust Two-Way Struct Communication by Passing in Closure
use std::cell::RefCell;
use std::rc::Rc;
pub struct CPU {
memory_bus: Rc<RefCell<MemoryBus>>,
oam_dma_page: RefCell<u8>,
}
impl CPU {
pub fn new(memory_bus: Rc<RefCell<MemoryBus>>) -> Self {