// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{ self as __sdk, __lib, __sats, __ws, }; use super::player_clock_type::PlayerClock; /// Table handle for the table `player_clock`. /// /// Obtain a handle from the [`PlayerClockTableAccess::player_clock`] method on [`super::RemoteTables`], /// like `ctx.db.player_clock()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player_clock().on_insert(...)`. pub struct PlayerClockTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `player_clock`. /// /// Implemented for [`super::RemoteTables`]. pub trait PlayerClockTableAccess { #[allow(non_snake_case)] /// Obtain a [`PlayerClockTableHandle`], which mediates access to the table `player_clock`. fn player_clock(&self) -> PlayerClockTableHandle<'_>; } impl PlayerClockTableAccess for super::RemoteTables { fn player_clock(&self) -> PlayerClockTableHandle<'_> { PlayerClockTableHandle { imp: self.imp.get_table::("player_clock"), ctx: std::marker::PhantomData, } } } pub struct PlayerClockInsertCallbackId(__sdk::CallbackId); pub struct PlayerClockDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PlayerClockTableHandle<'ctx> { type Row = PlayerClock; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PlayerClockInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PlayerClockInsertCallbackId { PlayerClockInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PlayerClockInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PlayerClockDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PlayerClockDeleteCallbackId { PlayerClockDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PlayerClockDeleteCallbackId) { self.imp.remove_on_delete(callback.0) } } #[doc(hidden)] pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { let _table = client_cache.get_or_make_table::("player_clock"); _table.add_unique_constraint::("id", |row| &row.id); _table.add_unique_constraint::("player_id", |row| &row.player_id); } pub struct PlayerClockUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for PlayerClockTableHandle<'ctx> { type UpdateCallbackId = PlayerClockUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> PlayerClockUpdateCallbackId { PlayerClockUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: PlayerClockUpdateCallbackId) { self.imp.remove_on_update(callback.0) } } #[doc(hidden)] pub(super) fn parse_table_update( raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, ) -> __sdk::Result<__sdk::TableUpdate> { __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { __sdk::InternalError::failed_parse( "TableUpdate", "TableUpdate", ).with_cause(e).into() }) } /// Access to the `id` unique index on the table `player_clock`, /// which allows point queries on the field of the same name /// via the [`PlayerClockIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player_clock().id().find(...)`. pub struct PlayerClockIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PlayerClockTableHandle<'ctx> { /// Get a handle on the `id` unique index on the table `player_clock`. pub fn id(&self) -> PlayerClockIdUnique<'ctx> { PlayerClockIdUnique { imp: self.imp.get_unique_constraint::("id"), phantom: std::marker::PhantomData, } } } impl<'ctx> PlayerClockIdUnique<'ctx> { /// Find the subscribed row whose `id` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &u32) -> Option { self.imp.find(col_val) } } /// Access to the `player_id` unique index on the table `player_clock`, /// which allows point queries on the field of the same name /// via the [`PlayerClockPlayerIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player_clock().player_id().find(...)`. pub struct PlayerClockPlayerIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PlayerClockTableHandle<'ctx> { /// Get a handle on the `player_id` unique index on the table `player_clock`. pub fn player_id(&self) -> PlayerClockPlayerIdUnique<'ctx> { PlayerClockPlayerIdUnique { imp: self.imp.get_unique_constraint::("player_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> PlayerClockPlayerIdUnique<'ctx> { /// Find the subscribed row whose `player_id` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &u32) -> Option { self.imp.find(col_val) } }