pub struct StateBridge { /* private fields */ }Expand description
State bridge for game state inspection
Provides unified access to game state whether using WasmRuntime (zero-copy) or BrowserController (serialized RPC).
Implementations§
Source§impl StateBridge
impl StateBridge
Sourcepub fn direct(memory_view: MemoryView) -> Self
pub fn direct(memory_view: MemoryView) -> Self
Create bridge with direct memory access (for WasmRuntime)
Sourcepub fn rpc(session_id: impl Into<String>) -> Self
pub fn rpc(session_id: impl Into<String>) -> Self
Create bridge with RPC connection (for BrowserController)
Sourcepub const fn memory_view(&self) -> Option<&MemoryView>
pub const fn memory_view(&self) -> Option<&MemoryView>
Get the memory view if using direct mode
Sourcepub fn query_entity(&self, entity_id: EntityId) -> ProbarResult<EntitySnapshot>
pub fn query_entity(&self, entity_id: EntityId) -> ProbarResult<EntitySnapshot>
Sourcepub fn snapshot(&mut self, frame: u64) -> ProbarResult<GameStateSnapshot>
pub fn snapshot(&mut self, frame: u64) -> ProbarResult<GameStateSnapshot>
Sourcepub fn record_delta(&mut self, delta: StateDelta)
pub fn record_delta(&mut self, delta: StateDelta)
Record a delta from current state
Sourcepub fn deltas(&self) -> &[StateDelta]
pub fn deltas(&self) -> &[StateDelta]
Get delta history
Sourcepub fn clear_deltas(&mut self)
pub fn clear_deltas(&mut self)
Clear delta history
Sourcepub fn compute_phash(image_data: &[u8]) -> u64
pub fn compute_phash(image_data: &[u8]) -> u64
Compute perceptual hash for image
Per Shamir [19]: pHash is more robust than pixel comparison
Sourcepub fn visual_compare(expected: &[u8], actual: &[u8]) -> VisualDiff
pub fn visual_compare(expected: &[u8], actual: &[u8]) -> VisualDiff
Compare two images using perceptual hash
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StateBridge
impl RefUnwindSafe for StateBridge
impl Send for StateBridge
impl Sync for StateBridge
impl Unpin for StateBridge
impl UnsafeUnpin for StateBridge
impl UnwindSafe for StateBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more