--- source: crates/codegen/tests/codegen.rs assertion_line: 37 expression: outfiles --- "add_player_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct AddPlayerArgs { pub name: String, } impl From for super::Reducer { fn from(args: AddPlayerArgs) -> Self { Self::AddPlayer { name: args.name, } } } impl __sdk::InModule for AddPlayerArgs { type Module = super::RemoteModule; } pub struct AddPlayerCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `add_player`. /// /// Implemented for [`super::RemoteReducers`]. pub trait add_player { /// Request that the remote module invoke the reducer `add_player` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_add_player`] callbacks. fn add_player(&self, name: String, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `add_player`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`AddPlayerCallbackId`] can be passed to [`Self::remove_on_add_player`] /// to cancel the callback. fn on_add_player(&self, callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static) -> AddPlayerCallbackId; /// Cancel a callback previously registered by [`Self::on_add_player`], /// causing it not to run in the future. fn remove_on_add_player(&self, callback: AddPlayerCallbackId); } impl add_player for super::RemoteReducers { fn add_player(&self, name: String, ) -> __sdk::Result<()> { self.imp.call_reducer("add_player", AddPlayerArgs { name, }) } fn on_add_player( &self, mut callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static, ) -> AddPlayerCallbackId { AddPlayerCallbackId(self.imp.on_reducer( "add_player", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::AddPlayer { name, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, name, ) }), )) } fn remove_on_add_player(&self, callback: AddPlayerCallbackId) { self.imp.remove_on_reducer("add_player", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `add_player`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_add_player { /// Set the call-reducer flags for the reducer `add_player` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn add_player(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_add_player for super::SetReducerFlags { fn add_player(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("add_player", flags); } } ''' "add_private_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct AddPrivateArgs { pub name: String, } impl From for super::Reducer { fn from(args: AddPrivateArgs) -> Self { Self::AddPrivate { name: args.name, } } } impl __sdk::InModule for AddPrivateArgs { type Module = super::RemoteModule; } pub struct AddPrivateCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `add_private`. /// /// Implemented for [`super::RemoteReducers`]. pub trait add_private { /// Request that the remote module invoke the reducer `add_private` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_add_private`] callbacks. fn add_private(&self, name: String, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `add_private`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`AddPrivateCallbackId`] can be passed to [`Self::remove_on_add_private`] /// to cancel the callback. fn on_add_private(&self, callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static) -> AddPrivateCallbackId; /// Cancel a callback previously registered by [`Self::on_add_private`], /// causing it not to run in the future. fn remove_on_add_private(&self, callback: AddPrivateCallbackId); } impl add_private for super::RemoteReducers { fn add_private(&self, name: String, ) -> __sdk::Result<()> { self.imp.call_reducer("add_private", AddPrivateArgs { name, }) } fn on_add_private( &self, mut callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static, ) -> AddPrivateCallbackId { AddPrivateCallbackId(self.imp.on_reducer( "add_private", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::AddPrivate { name, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, name, ) }), )) } fn remove_on_add_private(&self, callback: AddPrivateCallbackId) { self.imp.remove_on_reducer("add_private", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `add_private`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_add_private { /// Set the call-reducer flags for the reducer `add_private` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn add_private(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_add_private for super::SetReducerFlags { fn add_private(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("add_private", flags); } } ''' "add_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct AddArgs { pub name: String, pub age: u8, } impl From for super::Reducer { fn from(args: AddArgs) -> Self { Self::Add { name: args.name, age: args.age, } } } impl __sdk::InModule for AddArgs { type Module = super::RemoteModule; } pub struct AddCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `add`. /// /// Implemented for [`super::RemoteReducers`]. pub trait add { /// Request that the remote module invoke the reducer `add` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_add`] callbacks. fn add(&self, name: String, age: u8, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `add`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`AddCallbackId`] can be passed to [`Self::remove_on_add`] /// to cancel the callback. fn on_add(&self, callback: impl FnMut(&super::ReducerEventContext, &String, &u8, ) + Send + 'static) -> AddCallbackId; /// Cancel a callback previously registered by [`Self::on_add`], /// causing it not to run in the future. fn remove_on_add(&self, callback: AddCallbackId); } impl add for super::RemoteReducers { fn add(&self, name: String, age: u8, ) -> __sdk::Result<()> { self.imp.call_reducer("add", AddArgs { name, age, }) } fn on_add( &self, mut callback: impl FnMut(&super::ReducerEventContext, &String, &u8, ) + Send + 'static, ) -> AddCallbackId { AddCallbackId(self.imp.on_reducer( "add", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::Add { name, age, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, name, age, ) }), )) } fn remove_on_add(&self, callback: AddCallbackId) { self.imp.remove_on_reducer("add", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `add`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_add { /// Set the call-reducer flags for the reducer `add` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn add(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_add for super::SetReducerFlags { fn add(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("add", flags); } } ''' "assert_caller_identity_is_module_identity_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct AssertCallerIdentityIsModuleIdentityArgs { } impl From for super::Reducer { fn from(args: AssertCallerIdentityIsModuleIdentityArgs) -> Self { Self::AssertCallerIdentityIsModuleIdentity } } impl __sdk::InModule for AssertCallerIdentityIsModuleIdentityArgs { type Module = super::RemoteModule; } pub struct AssertCallerIdentityIsModuleIdentityCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `assert_caller_identity_is_module_identity`. /// /// Implemented for [`super::RemoteReducers`]. pub trait assert_caller_identity_is_module_identity { /// Request that the remote module invoke the reducer `assert_caller_identity_is_module_identity` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_assert_caller_identity_is_module_identity`] callbacks. fn assert_caller_identity_is_module_identity(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `assert_caller_identity_is_module_identity`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`AssertCallerIdentityIsModuleIdentityCallbackId`] can be passed to [`Self::remove_on_assert_caller_identity_is_module_identity`] /// to cancel the callback. fn on_assert_caller_identity_is_module_identity(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> AssertCallerIdentityIsModuleIdentityCallbackId; /// Cancel a callback previously registered by [`Self::on_assert_caller_identity_is_module_identity`], /// causing it not to run in the future. fn remove_on_assert_caller_identity_is_module_identity(&self, callback: AssertCallerIdentityIsModuleIdentityCallbackId); } impl assert_caller_identity_is_module_identity for super::RemoteReducers { fn assert_caller_identity_is_module_identity(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("assert_caller_identity_is_module_identity", AssertCallerIdentityIsModuleIdentityArgs { }) } fn on_assert_caller_identity_is_module_identity( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> AssertCallerIdentityIsModuleIdentityCallbackId { AssertCallerIdentityIsModuleIdentityCallbackId(self.imp.on_reducer( "assert_caller_identity_is_module_identity", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::AssertCallerIdentityIsModuleIdentity { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_assert_caller_identity_is_module_identity(&self, callback: AssertCallerIdentityIsModuleIdentityCallbackId) { self.imp.remove_on_reducer("assert_caller_identity_is_module_identity", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `assert_caller_identity_is_module_identity`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_assert_caller_identity_is_module_identity { /// Set the call-reducer flags for the reducer `assert_caller_identity_is_module_identity` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn assert_caller_identity_is_module_identity(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_assert_caller_identity_is_module_identity for super::SetReducerFlags { fn assert_caller_identity_is_module_identity(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("assert_caller_identity_is_module_identity", flags); } } ''' "baz_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Baz { pub field: String, } impl __sdk::InModule for Baz { type Module = super::RemoteModule; } ''' "client_connected_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct ClientConnectedArgs { } impl From for super::Reducer { fn from(args: ClientConnectedArgs) -> Self { Self::ClientConnected } } impl __sdk::InModule for ClientConnectedArgs { type Module = super::RemoteModule; } pub struct ClientConnectedCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `client_connected`. /// /// Implemented for [`super::RemoteReducers`]. pub trait client_connected { /// Request that the remote module invoke the reducer `client_connected` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_client_connected`] callbacks. fn client_connected(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `client_connected`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`ClientConnectedCallbackId`] can be passed to [`Self::remove_on_client_connected`] /// to cancel the callback. fn on_client_connected(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> ClientConnectedCallbackId; /// Cancel a callback previously registered by [`Self::on_client_connected`], /// causing it not to run in the future. fn remove_on_client_connected(&self, callback: ClientConnectedCallbackId); } impl client_connected for super::RemoteReducers { fn client_connected(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("client_connected", ClientConnectedArgs { }) } fn on_client_connected( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> ClientConnectedCallbackId { ClientConnectedCallbackId(self.imp.on_reducer( "client_connected", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::ClientConnected { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_client_connected(&self, callback: ClientConnectedCallbackId) { self.imp.remove_on_reducer("client_connected", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `client_connected`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_client_connected { /// Set the call-reducer flags for the reducer `client_connected` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn client_connected(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_client_connected for super::SetReducerFlags { fn client_connected(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("client_connected", flags); } } ''' "delete_player_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct DeletePlayerArgs { pub id: u64, } impl From for super::Reducer { fn from(args: DeletePlayerArgs) -> Self { Self::DeletePlayer { id: args.id, } } } impl __sdk::InModule for DeletePlayerArgs { type Module = super::RemoteModule; } pub struct DeletePlayerCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `delete_player`. /// /// Implemented for [`super::RemoteReducers`]. pub trait delete_player { /// Request that the remote module invoke the reducer `delete_player` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_delete_player`] callbacks. fn delete_player(&self, id: u64, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `delete_player`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`DeletePlayerCallbackId`] can be passed to [`Self::remove_on_delete_player`] /// to cancel the callback. fn on_delete_player(&self, callback: impl FnMut(&super::ReducerEventContext, &u64, ) + Send + 'static) -> DeletePlayerCallbackId; /// Cancel a callback previously registered by [`Self::on_delete_player`], /// causing it not to run in the future. fn remove_on_delete_player(&self, callback: DeletePlayerCallbackId); } impl delete_player for super::RemoteReducers { fn delete_player(&self, id: u64, ) -> __sdk::Result<()> { self.imp.call_reducer("delete_player", DeletePlayerArgs { id, }) } fn on_delete_player( &self, mut callback: impl FnMut(&super::ReducerEventContext, &u64, ) + Send + 'static, ) -> DeletePlayerCallbackId { DeletePlayerCallbackId(self.imp.on_reducer( "delete_player", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::DeletePlayer { id, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, id, ) }), )) } fn remove_on_delete_player(&self, callback: DeletePlayerCallbackId) { self.imp.remove_on_reducer("delete_player", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `delete_player`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_delete_player { /// Set the call-reducer flags for the reducer `delete_player` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn delete_player(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_delete_player for super::SetReducerFlags { fn delete_player(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("delete_player", flags); } } ''' "delete_players_by_name_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct DeletePlayersByNameArgs { pub name: String, } impl From for super::Reducer { fn from(args: DeletePlayersByNameArgs) -> Self { Self::DeletePlayersByName { name: args.name, } } } impl __sdk::InModule for DeletePlayersByNameArgs { type Module = super::RemoteModule; } pub struct DeletePlayersByNameCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `delete_players_by_name`. /// /// Implemented for [`super::RemoteReducers`]. pub trait delete_players_by_name { /// Request that the remote module invoke the reducer `delete_players_by_name` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_delete_players_by_name`] callbacks. fn delete_players_by_name(&self, name: String, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `delete_players_by_name`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`DeletePlayersByNameCallbackId`] can be passed to [`Self::remove_on_delete_players_by_name`] /// to cancel the callback. fn on_delete_players_by_name(&self, callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static) -> DeletePlayersByNameCallbackId; /// Cancel a callback previously registered by [`Self::on_delete_players_by_name`], /// causing it not to run in the future. fn remove_on_delete_players_by_name(&self, callback: DeletePlayersByNameCallbackId); } impl delete_players_by_name for super::RemoteReducers { fn delete_players_by_name(&self, name: String, ) -> __sdk::Result<()> { self.imp.call_reducer("delete_players_by_name", DeletePlayersByNameArgs { name, }) } fn on_delete_players_by_name( &self, mut callback: impl FnMut(&super::ReducerEventContext, &String, ) + Send + 'static, ) -> DeletePlayersByNameCallbackId { DeletePlayersByNameCallbackId(self.imp.on_reducer( "delete_players_by_name", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::DeletePlayersByName { name, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, name, ) }), )) } fn remove_on_delete_players_by_name(&self, callback: DeletePlayersByNameCallbackId) { self.imp.remove_on_reducer("delete_players_by_name", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `delete_players_by_name`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_delete_players_by_name { /// Set the call-reducer flags for the reducer `delete_players_by_name` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn delete_players_by_name(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_delete_players_by_name for super::SetReducerFlags { fn delete_players_by_name(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("delete_players_by_name", flags); } } ''' "foobar_type.rs" = ''' // 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::baz_type::Baz; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub enum Foobar { Baz(Baz), Bar, Har(u32), } impl __sdk::InModule for Foobar { type Module = super::RemoteModule; } ''' "get_my_schema_via_http_procedure.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] struct GetMySchemaViaHttpArgs { } impl __sdk::InModule for GetMySchemaViaHttpArgs { type Module = super::RemoteModule; } #[allow(non_camel_case_types)] /// Extension trait for access to the procedure `get_my_schema_via_http`. /// /// Implemented for [`super::RemoteProcedures`]. pub trait get_my_schema_via_http { fn get_my_schema_via_http(&self, ) { self.get_my_schema_via_http_then( |_, _| {}); } fn get_my_schema_via_http_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, ); } impl get_my_schema_via_http for super::RemoteProcedures { fn get_my_schema_via_http_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, ) { self.imp.invoke_procedure_with_callback::<_, String>( "get_my_schema_via_http", GetMySchemaViaHttpArgs { }, __callback, ); } } ''' "has_special_stuff_table.rs" = ''' // 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::has_special_stuff_type::HasSpecialStuff; /// Table handle for the table `has_special_stuff`. /// /// Obtain a handle from the [`HasSpecialStuffTableAccess::has_special_stuff`] method on [`super::RemoteTables`], /// like `ctx.db.has_special_stuff()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.has_special_stuff().on_insert(...)`. pub struct HasSpecialStuffTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `has_special_stuff`. /// /// Implemented for [`super::RemoteTables`]. pub trait HasSpecialStuffTableAccess { #[allow(non_snake_case)] /// Obtain a [`HasSpecialStuffTableHandle`], which mediates access to the table `has_special_stuff`. fn has_special_stuff(&self) -> HasSpecialStuffTableHandle<'_>; } impl HasSpecialStuffTableAccess for super::RemoteTables { fn has_special_stuff(&self) -> HasSpecialStuffTableHandle<'_> { HasSpecialStuffTableHandle { imp: self.imp.get_table::("has_special_stuff"), ctx: std::marker::PhantomData, } } } pub struct HasSpecialStuffInsertCallbackId(__sdk::CallbackId); pub struct HasSpecialStuffDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for HasSpecialStuffTableHandle<'ctx> { type Row = HasSpecialStuff; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = HasSpecialStuffInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> HasSpecialStuffInsertCallbackId { HasSpecialStuffInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: HasSpecialStuffInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = HasSpecialStuffDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> HasSpecialStuffDeleteCallbackId { HasSpecialStuffDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: HasSpecialStuffDeleteCallbackId) { 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::("has_special_stuff"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `HasSpecialStuff`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait has_special_stuffQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `HasSpecialStuff`. fn has_special_stuff(&self) -> __sdk::__query_builder::Table; } impl has_special_stuffQueryTableAccess for __sdk::QueryTableAccessor { fn has_special_stuff(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("has_special_stuff") } } ''' "has_special_stuff_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct HasSpecialStuff { pub identity: __sdk::Identity, pub connection_id: __sdk::ConnectionId, } impl __sdk::InModule for HasSpecialStuff { type Module = super::RemoteModule; } /// Column accessor struct for the table `HasSpecialStuff`. /// /// Provides typed access to columns for query building. pub struct HasSpecialStuffCols { pub identity: __sdk::__query_builder::Col, pub connection_id: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for HasSpecialStuff { type Cols = HasSpecialStuffCols; fn cols(table_name: &'static str) -> Self::Cols { HasSpecialStuffCols { identity: __sdk::__query_builder::Col::new(table_name, "identity"), connection_id: __sdk::__query_builder::Col::new(table_name, "connection_id"), } } } /// Indexed column accessor struct for the table `HasSpecialStuff`. /// /// Provides typed access to indexed columns for query building. pub struct HasSpecialStuffIxCols { } impl __sdk::__query_builder::HasIxCols for HasSpecialStuff { type IxCols = HasSpecialStuffIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { HasSpecialStuffIxCols { } } } ''' "list_over_age_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct ListOverAgeArgs { pub age: u8, } impl From for super::Reducer { fn from(args: ListOverAgeArgs) -> Self { Self::ListOverAge { age: args.age, } } } impl __sdk::InModule for ListOverAgeArgs { type Module = super::RemoteModule; } pub struct ListOverAgeCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `list_over_age`. /// /// Implemented for [`super::RemoteReducers`]. pub trait list_over_age { /// Request that the remote module invoke the reducer `list_over_age` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_list_over_age`] callbacks. fn list_over_age(&self, age: u8, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `list_over_age`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`ListOverAgeCallbackId`] can be passed to [`Self::remove_on_list_over_age`] /// to cancel the callback. fn on_list_over_age(&self, callback: impl FnMut(&super::ReducerEventContext, &u8, ) + Send + 'static) -> ListOverAgeCallbackId; /// Cancel a callback previously registered by [`Self::on_list_over_age`], /// causing it not to run in the future. fn remove_on_list_over_age(&self, callback: ListOverAgeCallbackId); } impl list_over_age for super::RemoteReducers { fn list_over_age(&self, age: u8, ) -> __sdk::Result<()> { self.imp.call_reducer("list_over_age", ListOverAgeArgs { age, }) } fn on_list_over_age( &self, mut callback: impl FnMut(&super::ReducerEventContext, &u8, ) + Send + 'static, ) -> ListOverAgeCallbackId { ListOverAgeCallbackId(self.imp.on_reducer( "list_over_age", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::ListOverAge { age, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, age, ) }), )) } fn remove_on_list_over_age(&self, callback: ListOverAgeCallbackId) { self.imp.remove_on_reducer("list_over_age", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `list_over_age`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_list_over_age { /// Set the call-reducer flags for the reducer `list_over_age` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn list_over_age(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_list_over_age for super::SetReducerFlags { fn list_over_age(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("list_over_age", flags); } } ''' "log_module_identity_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct LogModuleIdentityArgs { } impl From for super::Reducer { fn from(args: LogModuleIdentityArgs) -> Self { Self::LogModuleIdentity } } impl __sdk::InModule for LogModuleIdentityArgs { type Module = super::RemoteModule; } pub struct LogModuleIdentityCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `log_module_identity`. /// /// Implemented for [`super::RemoteReducers`]. pub trait log_module_identity { /// Request that the remote module invoke the reducer `log_module_identity` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_log_module_identity`] callbacks. fn log_module_identity(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `log_module_identity`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`LogModuleIdentityCallbackId`] can be passed to [`Self::remove_on_log_module_identity`] /// to cancel the callback. fn on_log_module_identity(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> LogModuleIdentityCallbackId; /// Cancel a callback previously registered by [`Self::on_log_module_identity`], /// causing it not to run in the future. fn remove_on_log_module_identity(&self, callback: LogModuleIdentityCallbackId); } impl log_module_identity for super::RemoteReducers { fn log_module_identity(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("log_module_identity", LogModuleIdentityArgs { }) } fn on_log_module_identity( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> LogModuleIdentityCallbackId { LogModuleIdentityCallbackId(self.imp.on_reducer( "log_module_identity", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::LogModuleIdentity { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_log_module_identity(&self, callback: LogModuleIdentityCallbackId) { self.imp.remove_on_reducer("log_module_identity", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `log_module_identity`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_log_module_identity { /// Set the call-reducer flags for the reducer `log_module_identity` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn log_module_identity(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_log_module_identity for super::SetReducerFlags { fn log_module_identity(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("log_module_identity", flags); } } ''' "logged_out_player_table.rs" = ''' // 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_type::Player; /// Table handle for the table `logged_out_player`. /// /// Obtain a handle from the [`LoggedOutPlayerTableAccess::logged_out_player`] method on [`super::RemoteTables`], /// like `ctx.db.logged_out_player()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.logged_out_player().on_insert(...)`. pub struct LoggedOutPlayerTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `logged_out_player`. /// /// Implemented for [`super::RemoteTables`]. pub trait LoggedOutPlayerTableAccess { #[allow(non_snake_case)] /// Obtain a [`LoggedOutPlayerTableHandle`], which mediates access to the table `logged_out_player`. fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_>; } impl LoggedOutPlayerTableAccess for super::RemoteTables { fn logged_out_player(&self) -> LoggedOutPlayerTableHandle<'_> { LoggedOutPlayerTableHandle { imp: self.imp.get_table::("logged_out_player"), ctx: std::marker::PhantomData, } } } pub struct LoggedOutPlayerInsertCallbackId(__sdk::CallbackId); pub struct LoggedOutPlayerDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for LoggedOutPlayerTableHandle<'ctx> { type Row = Player; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = LoggedOutPlayerInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> LoggedOutPlayerInsertCallbackId { LoggedOutPlayerInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: LoggedOutPlayerInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = LoggedOutPlayerDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> LoggedOutPlayerDeleteCallbackId { LoggedOutPlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: LoggedOutPlayerDeleteCallbackId) { 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::("logged_out_player"); _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity); _table.add_unique_constraint::("player_id", |row| &row.player_id); _table.add_unique_constraint::("name", |row| &row.name); } pub struct LoggedOutPlayerUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for LoggedOutPlayerTableHandle<'ctx> { type UpdateCallbackId = LoggedOutPlayerUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> LoggedOutPlayerUpdateCallbackId { LoggedOutPlayerUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: LoggedOutPlayerUpdateCallbackId) { 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 `identity` unique index on the table `logged_out_player`, /// which allows point queries on the field of the same name /// via the [`LoggedOutPlayerIdentityUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.logged_out_player().identity().find(...)`. pub struct LoggedOutPlayerIdentityUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> LoggedOutPlayerTableHandle<'ctx> { /// Get a handle on the `identity` unique index on the table `logged_out_player`. pub fn identity(&self) -> LoggedOutPlayerIdentityUnique<'ctx> { LoggedOutPlayerIdentityUnique { imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"), phantom: std::marker::PhantomData, } } } impl<'ctx> LoggedOutPlayerIdentityUnique<'ctx> { /// Find the subscribed row whose `identity` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &__sdk::Identity) -> Option { self.imp.find(col_val) } } /// Access to the `player_id` unique index on the table `logged_out_player`, /// which allows point queries on the field of the same name /// via the [`LoggedOutPlayerPlayerIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.logged_out_player().player_id().find(...)`. pub struct LoggedOutPlayerPlayerIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> LoggedOutPlayerTableHandle<'ctx> { /// Get a handle on the `player_id` unique index on the table `logged_out_player`. pub fn player_id(&self) -> LoggedOutPlayerPlayerIdUnique<'ctx> { LoggedOutPlayerPlayerIdUnique { imp: self.imp.get_unique_constraint::("player_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> LoggedOutPlayerPlayerIdUnique<'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: &u64) -> Option { self.imp.find(col_val) } } /// Access to the `name` unique index on the table `logged_out_player`, /// which allows point queries on the field of the same name /// via the [`LoggedOutPlayerNameUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.logged_out_player().name().find(...)`. pub struct LoggedOutPlayerNameUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> LoggedOutPlayerTableHandle<'ctx> { /// Get a handle on the `name` unique index on the table `logged_out_player`. pub fn name(&self) -> LoggedOutPlayerNameUnique<'ctx> { LoggedOutPlayerNameUnique { imp: self.imp.get_unique_constraint::("name"), phantom: std::marker::PhantomData, } } } impl<'ctx> LoggedOutPlayerNameUnique<'ctx> { /// Find the subscribed row whose `name` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &String) -> Option { self.imp.find(col_val) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `Player`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait logged_out_playerQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `Player`. fn logged_out_player(&self) -> __sdk::__query_builder::Table; } impl logged_out_playerQueryTableAccess for __sdk::QueryTableAccessor { fn logged_out_player(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("logged_out_player") } } ''' "mod.rs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. VERSION_COMMENT #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{ self as __sdk, __lib, __sats, __ws, }; pub mod baz_type; pub mod foobar_type; pub mod has_special_stuff_type; pub mod person_type; pub mod pk_multi_identity_type; pub mod player_type; pub mod point_type; pub mod private_table_type; pub mod remove_table_type; pub mod repeating_test_arg_type; pub mod test_a_type; pub mod test_b_type; pub mod test_d_type; pub mod test_e_type; pub mod test_foobar_type; pub mod namespace_test_c_type; pub mod namespace_test_f_type; pub mod add_reducer; pub mod add_player_reducer; pub mod add_private_reducer; pub mod assert_caller_identity_is_module_identity_reducer; pub mod client_connected_reducer; pub mod delete_player_reducer; pub mod delete_players_by_name_reducer; pub mod list_over_age_reducer; pub mod log_module_identity_reducer; pub mod query_private_reducer; pub mod repeating_test_reducer; pub mod say_hello_reducer; pub mod test_reducer; pub mod test_btree_index_args_reducer; pub mod has_special_stuff_table; pub mod logged_out_player_table; pub mod person_table; pub mod pk_multi_identity_table; pub mod player_table; pub mod points_table; pub mod private_table_table; pub mod repeating_test_arg_table; pub mod table_to_remove_table; pub mod test_a_table; pub mod test_d_table; pub mod test_e_table; pub mod test_f_table; pub mod my_player_table; pub mod get_my_schema_via_http_procedure; pub mod return_value_procedure; pub mod sleep_one_second_procedure; pub mod with_tx_procedure; pub use baz_type::Baz; pub use foobar_type::Foobar; pub use has_special_stuff_type::HasSpecialStuff; pub use person_type::Person; pub use pk_multi_identity_type::PkMultiIdentity; pub use player_type::Player; pub use point_type::Point; pub use private_table_type::PrivateTable; pub use remove_table_type::RemoveTable; pub use repeating_test_arg_type::RepeatingTestArg; pub use test_a_type::TestA; pub use test_b_type::TestB; pub use test_d_type::TestD; pub use test_e_type::TestE; pub use test_foobar_type::TestFoobar; pub use namespace_test_c_type::NamespaceTestC; pub use namespace_test_f_type::NamespaceTestF; pub use has_special_stuff_table::*; pub use logged_out_player_table::*; pub use my_player_table::*; pub use person_table::*; pub use pk_multi_identity_table::*; pub use player_table::*; pub use points_table::*; pub use private_table_table::*; pub use repeating_test_arg_table::*; pub use table_to_remove_table::*; pub use test_a_table::*; pub use test_d_table::*; pub use test_e_table::*; pub use test_f_table::*; pub use add_reducer::{add, set_flags_for_add, AddCallbackId}; pub use add_player_reducer::{add_player, set_flags_for_add_player, AddPlayerCallbackId}; pub use add_private_reducer::{add_private, set_flags_for_add_private, AddPrivateCallbackId}; pub use assert_caller_identity_is_module_identity_reducer::{assert_caller_identity_is_module_identity, set_flags_for_assert_caller_identity_is_module_identity, AssertCallerIdentityIsModuleIdentityCallbackId}; pub use client_connected_reducer::{client_connected, set_flags_for_client_connected, ClientConnectedCallbackId}; pub use delete_player_reducer::{delete_player, set_flags_for_delete_player, DeletePlayerCallbackId}; pub use delete_players_by_name_reducer::{delete_players_by_name, set_flags_for_delete_players_by_name, DeletePlayersByNameCallbackId}; pub use list_over_age_reducer::{list_over_age, set_flags_for_list_over_age, ListOverAgeCallbackId}; pub use log_module_identity_reducer::{log_module_identity, set_flags_for_log_module_identity, LogModuleIdentityCallbackId}; pub use query_private_reducer::{query_private, set_flags_for_query_private, QueryPrivateCallbackId}; pub use repeating_test_reducer::{repeating_test, set_flags_for_repeating_test, RepeatingTestCallbackId}; pub use say_hello_reducer::{say_hello, set_flags_for_say_hello, SayHelloCallbackId}; pub use test_reducer::{test, set_flags_for_test, TestCallbackId}; pub use test_btree_index_args_reducer::{test_btree_index_args, set_flags_for_test_btree_index_args, TestBtreeIndexArgsCallbackId}; pub use get_my_schema_via_http_procedure::get_my_schema_via_http; pub use return_value_procedure::return_value; pub use sleep_one_second_procedure::sleep_one_second; pub use with_tx_procedure::with_tx; #[derive(Clone, PartialEq, Debug)] /// One of the reducers defined by this module. /// /// Contained within a [`__sdk::ReducerEvent`] in [`EventContext`]s for reducer events /// to indicate which reducer caused the event. pub enum Reducer { Add { name: String, age: u8, } , AddPlayer { name: String, } , AddPrivate { name: String, } , AssertCallerIdentityIsModuleIdentity , ClientConnected , DeletePlayer { id: u64, } , DeletePlayersByName { name: String, } , ListOverAge { age: u8, } , LogModuleIdentity , QueryPrivate , RepeatingTest { arg: RepeatingTestArg, } , SayHello , Test { arg: TestA, arg_2: TestB, arg_3: NamespaceTestC, arg_4: NamespaceTestF, } , TestBtreeIndexArgs , } impl __sdk::InModule for Reducer { type Module = RemoteModule; } impl __sdk::Reducer for Reducer { fn reducer_name(&self) -> &'static str { match self { Reducer::Add { .. } => "add", Reducer::AddPlayer { .. } => "add_player", Reducer::AddPrivate { .. } => "add_private", Reducer::AssertCallerIdentityIsModuleIdentity => "assert_caller_identity_is_module_identity", Reducer::ClientConnected => "client_connected", Reducer::DeletePlayer { .. } => "delete_player", Reducer::DeletePlayersByName { .. } => "delete_players_by_name", Reducer::ListOverAge { .. } => "list_over_age", Reducer::LogModuleIdentity => "log_module_identity", Reducer::QueryPrivate => "query_private", Reducer::RepeatingTest { .. } => "repeating_test", Reducer::SayHello => "say_hello", Reducer::Test { .. } => "test", Reducer::TestBtreeIndexArgs => "test_btree_index_args", _ => unreachable!(), } } } impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { type Error = __sdk::Error; fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result { match &value.reducer_name[..] { "add" => Ok(__sdk::parse_reducer_args::("add", &value.args)?.into()), "add_player" => Ok(__sdk::parse_reducer_args::("add_player", &value.args)?.into()), "add_private" => Ok(__sdk::parse_reducer_args::("add_private", &value.args)?.into()), "assert_caller_identity_is_module_identity" => Ok(__sdk::parse_reducer_args::("assert_caller_identity_is_module_identity", &value.args)?.into()), "client_connected" => Ok(__sdk::parse_reducer_args::("client_connected", &value.args)?.into()), "delete_player" => Ok(__sdk::parse_reducer_args::("delete_player", &value.args)?.into()), "delete_players_by_name" => Ok(__sdk::parse_reducer_args::("delete_players_by_name", &value.args)?.into()), "list_over_age" => Ok(__sdk::parse_reducer_args::("list_over_age", &value.args)?.into()), "log_module_identity" => Ok(__sdk::parse_reducer_args::("log_module_identity", &value.args)?.into()), "query_private" => Ok(__sdk::parse_reducer_args::("query_private", &value.args)?.into()), "repeating_test" => Ok(__sdk::parse_reducer_args::("repeating_test", &value.args)?.into()), "say_hello" => Ok(__sdk::parse_reducer_args::("say_hello", &value.args)?.into()), "test" => Ok(__sdk::parse_reducer_args::("test", &value.args)?.into()), "test_btree_index_args" => Ok(__sdk::parse_reducer_args::("test_btree_index_args", &value.args)?.into()), unknown => Err(__sdk::InternalError::unknown_name("reducer", unknown, "ReducerCallInfo").into()), } } } #[derive(Default)] #[allow(non_snake_case)] #[doc(hidden)] pub struct DbUpdate { has_special_stuff: __sdk::TableUpdate, logged_out_player: __sdk::TableUpdate, my_player: __sdk::TableUpdate, person: __sdk::TableUpdate, pk_multi_identity: __sdk::TableUpdate, player: __sdk::TableUpdate, points: __sdk::TableUpdate, private_table: __sdk::TableUpdate, repeating_test_arg: __sdk::TableUpdate, table_to_remove: __sdk::TableUpdate, test_a: __sdk::TableUpdate, test_d: __sdk::TableUpdate, test_e: __sdk::TableUpdate, test_f: __sdk::TableUpdate, } impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { type Error = __sdk::Error; fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { let mut db_update = DbUpdate::default(); for table_update in raw.tables { match &table_update.table_name[..] { "has_special_stuff" => db_update.has_special_stuff.append(has_special_stuff_table::parse_table_update(table_update)?), "logged_out_player" => db_update.logged_out_player.append(logged_out_player_table::parse_table_update(table_update)?), "my_player" => db_update.my_player.append(my_player_table::parse_table_update(table_update)?), "person" => db_update.person.append(person_table::parse_table_update(table_update)?), "pk_multi_identity" => db_update.pk_multi_identity.append(pk_multi_identity_table::parse_table_update(table_update)?), "player" => db_update.player.append(player_table::parse_table_update(table_update)?), "points" => db_update.points.append(points_table::parse_table_update(table_update)?), "private_table" => db_update.private_table.append(private_table_table::parse_table_update(table_update)?), "repeating_test_arg" => db_update.repeating_test_arg.append(repeating_test_arg_table::parse_table_update(table_update)?), "table_to_remove" => db_update.table_to_remove.append(table_to_remove_table::parse_table_update(table_update)?), "test_a" => db_update.test_a.append(test_a_table::parse_table_update(table_update)?), "test_d" => db_update.test_d.append(test_d_table::parse_table_update(table_update)?), "test_e" => db_update.test_e.append(test_e_table::parse_table_update(table_update)?), "test_f" => db_update.test_f.append(test_f_table::parse_table_update(table_update)?), unknown => { return Err(__sdk::InternalError::unknown_name( "table", unknown, "DatabaseUpdate", ).into()); } } } Ok(db_update) } } impl __sdk::InModule for DbUpdate { type Module = RemoteModule; } impl __sdk::DbUpdate for DbUpdate { fn apply_to_client_cache(&self, cache: &mut __sdk::ClientCache) -> AppliedDiff<'_> { let mut diff = AppliedDiff::default(); diff.has_special_stuff = cache.apply_diff_to_table::("has_special_stuff", &self.has_special_stuff); diff.logged_out_player = cache.apply_diff_to_table::("logged_out_player", &self.logged_out_player).with_updates_by_pk(|row| &row.identity); diff.person = cache.apply_diff_to_table::("person", &self.person).with_updates_by_pk(|row| &row.id); diff.pk_multi_identity = cache.apply_diff_to_table::("pk_multi_identity", &self.pk_multi_identity).with_updates_by_pk(|row| &row.id); diff.player = cache.apply_diff_to_table::("player", &self.player).with_updates_by_pk(|row| &row.identity); diff.points = cache.apply_diff_to_table::("points", &self.points); diff.private_table = cache.apply_diff_to_table::("private_table", &self.private_table); diff.repeating_test_arg = cache.apply_diff_to_table::("repeating_test_arg", &self.repeating_test_arg).with_updates_by_pk(|row| &row.scheduled_id); diff.table_to_remove = cache.apply_diff_to_table::("table_to_remove", &self.table_to_remove); diff.test_a = cache.apply_diff_to_table::("test_a", &self.test_a); diff.test_d = cache.apply_diff_to_table::("test_d", &self.test_d); diff.test_e = cache.apply_diff_to_table::("test_e", &self.test_e).with_updates_by_pk(|row| &row.id); diff.test_f = cache.apply_diff_to_table::("test_f", &self.test_f); diff.my_player = cache.apply_diff_to_table::("my_player", &self.my_player); diff } } #[derive(Default)] #[allow(non_snake_case)] #[doc(hidden)] pub struct AppliedDiff<'r> { has_special_stuff: __sdk::TableAppliedDiff<'r, HasSpecialStuff>, logged_out_player: __sdk::TableAppliedDiff<'r, Player>, my_player: __sdk::TableAppliedDiff<'r, Player>, person: __sdk::TableAppliedDiff<'r, Person>, pk_multi_identity: __sdk::TableAppliedDiff<'r, PkMultiIdentity>, player: __sdk::TableAppliedDiff<'r, Player>, points: __sdk::TableAppliedDiff<'r, Point>, private_table: __sdk::TableAppliedDiff<'r, PrivateTable>, repeating_test_arg: __sdk::TableAppliedDiff<'r, RepeatingTestArg>, table_to_remove: __sdk::TableAppliedDiff<'r, RemoveTable>, test_a: __sdk::TableAppliedDiff<'r, TestA>, test_d: __sdk::TableAppliedDiff<'r, TestD>, test_e: __sdk::TableAppliedDiff<'r, TestE>, test_f: __sdk::TableAppliedDiff<'r, TestFoobar>, __unused: std::marker::PhantomData<&'r ()>, } impl __sdk::InModule for AppliedDiff<'_> { type Module = RemoteModule; } impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> { fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks) { callbacks.invoke_table_row_callbacks::("has_special_stuff", &self.has_special_stuff, event); callbacks.invoke_table_row_callbacks::("logged_out_player", &self.logged_out_player, event); callbacks.invoke_table_row_callbacks::("my_player", &self.my_player, event); callbacks.invoke_table_row_callbacks::("person", &self.person, event); callbacks.invoke_table_row_callbacks::("pk_multi_identity", &self.pk_multi_identity, event); callbacks.invoke_table_row_callbacks::("player", &self.player, event); callbacks.invoke_table_row_callbacks::("points", &self.points, event); callbacks.invoke_table_row_callbacks::("private_table", &self.private_table, event); callbacks.invoke_table_row_callbacks::("repeating_test_arg", &self.repeating_test_arg, event); callbacks.invoke_table_row_callbacks::("table_to_remove", &self.table_to_remove, event); callbacks.invoke_table_row_callbacks::("test_a", &self.test_a, event); callbacks.invoke_table_row_callbacks::("test_d", &self.test_d, event); callbacks.invoke_table_row_callbacks::("test_e", &self.test_e, event); callbacks.invoke_table_row_callbacks::("test_f", &self.test_f, event); } } #[doc(hidden)] pub struct RemoteModule; impl __sdk::InModule for RemoteModule { type Module = Self; } /// The `reducers` field of [`EventContext`] and [`DbConnection`], /// with methods provided by extension traits for each reducer defined by the module. pub struct RemoteReducers { imp: __sdk::DbContextImpl, } impl __sdk::InModule for RemoteReducers { type Module = RemoteModule; } /// The `procedures` field of [`DbConnection`] and other [`DbContext`] types, /// with methods provided by extension traits for each procedure defined by the module. pub struct RemoteProcedures { imp: __sdk::DbContextImpl, } impl __sdk::InModule for RemoteProcedures { type Module = RemoteModule; } #[doc(hidden)] /// The `set_reducer_flags` field of [`DbConnection`], /// with methods provided by extension traits for each reducer defined by the module. /// Each method sets the flags for the reducer with the same name. /// /// This type is currently unstable and may be removed without a major version bump. pub struct SetReducerFlags { imp: __sdk::DbContextImpl, } impl __sdk::InModule for SetReducerFlags { type Module = RemoteModule; } /// The `db` field of [`EventContext`] and [`DbConnection`], /// with methods provided by extension traits for each table defined by the module. pub struct RemoteTables { imp: __sdk::DbContextImpl, } impl __sdk::InModule for RemoteTables { type Module = RemoteModule; } /// A connection to a remote module, including a materialized view of a subset of the database. /// /// Connect to a remote module by calling [`DbConnection::builder`] /// and using the [`__sdk::DbConnectionBuilder`] builder-pattern constructor. /// /// You must explicitly advance the connection by calling any one of: /// /// - [`DbConnection::frame_tick`]. /// - [`DbConnection::run_threaded`]. /// - [`DbConnection::run_async`]. /// - [`DbConnection::advance_one_message`]. /// - [`DbConnection::advance_one_message_blocking`]. /// - [`DbConnection::advance_one_message_async`]. /// /// Which of these methods you should call depends on the specific needs of your application, /// but you must call one of them, or else the connection will never progress. pub struct DbConnection { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, #[doc(hidden)] /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, imp: __sdk::DbContextImpl, } impl __sdk::InModule for DbConnection { type Module = RemoteModule; } impl __sdk::DbContext for DbConnection { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl DbConnection { /// Builder-pattern constructor for a connection to a remote module. /// /// See [`__sdk::DbConnectionBuilder`] for required and optional configuration for the new connection. pub fn builder() -> __sdk::DbConnectionBuilder { __sdk::DbConnectionBuilder::new() } /// If any WebSocket messages are waiting, process one of them. /// /// Returns `true` if a message was processed, or `false` if the queue is empty. /// Callers should invoke this message in a loop until it returns `false` /// or for as much time is available to process messages. /// /// Returns an error if the connection is disconnected. /// If the disconnection in question was normal, /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. /// /// This is a low-level primitive exposed for power users who need significant control over scheduling. /// Most applications should call [`Self::frame_tick`] each frame /// to fully exhaust the queue whenever time is available. pub fn advance_one_message(&self) -> __sdk::Result { self.imp.advance_one_message() } /// Process one WebSocket message, potentially blocking the current thread until one is received. /// /// Returns an error if the connection is disconnected. /// If the disconnection in question was normal, /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. /// /// This is a low-level primitive exposed for power users who need significant control over scheduling. /// Most applications should call [`Self::run_threaded`] to spawn a thread /// which advances the connection automatically. pub fn advance_one_message_blocking(&self) -> __sdk::Result<()> { self.imp.advance_one_message_blocking() } /// Process one WebSocket message, `await`ing until one is received. /// /// Returns an error if the connection is disconnected. /// If the disconnection in question was normal, /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. /// /// This is a low-level primitive exposed for power users who need significant control over scheduling. /// Most applications should call [`Self::run_async`] to run an `async` loop /// which advances the connection when polled. pub async fn advance_one_message_async(&self) -> __sdk::Result<()> { self.imp.advance_one_message_async().await } /// Process all WebSocket messages waiting in the queue, /// then return without `await`ing or blocking the current thread. pub fn frame_tick(&self) -> __sdk::Result<()> { self.imp.frame_tick() } /// Spawn a thread which processes WebSocket messages as they are received. pub fn run_threaded(&self) -> std::thread::JoinHandle<()> { self.imp.run_threaded() } /// Run an `async` loop which processes WebSocket messages when polled. pub async fn run_async(&self) -> __sdk::Result<()> { self.imp.run_async().await } } impl __sdk::DbConnection for DbConnection { fn new(imp: __sdk::DbContextImpl) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, imp, } } } /// A handle on a subscribed query. // TODO: Document this better after implementing the new subscription API. #[derive(Clone)] pub struct SubscriptionHandle { imp: __sdk::SubscriptionHandleImpl, } impl __sdk::InModule for SubscriptionHandle { type Module = RemoteModule; } impl __sdk::SubscriptionHandle for SubscriptionHandle { fn new(imp: __sdk::SubscriptionHandleImpl) -> Self { Self { imp } } /// Returns true if this subscription has been terminated due to an unsubscribe call or an error. fn is_ended(&self) -> bool { self.imp.is_ended() } /// Returns true if this subscription has been applied and has not yet been unsubscribed. fn is_active(&self) -> bool { self.imp.is_active() } /// Unsubscribe from the query controlled by this `SubscriptionHandle`, /// then run `on_end` when its rows are removed from the client cache. fn unsubscribe_then(self, on_end: __sdk::OnEndedCallback) -> __sdk::Result<()> { self.imp.unsubscribe_then(Some(on_end)) } fn unsubscribe(self) -> __sdk::Result<()> { self.imp.unsubscribe_then(None) } } /// Alias trait for a [`__sdk::DbContext`] connected to this module, /// with that trait's associated types bounded to this module's concrete types. /// /// Users can use this trait as a boundary on definitions which should accept /// either a [`DbConnection`] or an [`EventContext`] and operate on either. pub trait RemoteDbContext: __sdk::DbContext< DbView = RemoteTables, Reducers = RemoteReducers, SetReducerFlags = SetReducerFlags, SubscriptionBuilder = __sdk::SubscriptionBuilder, > {} impl, >> RemoteDbContext for Ctx {} /// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`], /// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks. pub struct EventContext { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, /// The event which caused these callbacks to run. pub event: __sdk::Event, imp: __sdk::DbContextImpl, } impl __sdk::AbstractEventContext for EventContext { type Event = __sdk::Event; fn event(&self) -> &Self::Event { &self.event } fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, event, imp, } } } impl __sdk::InModule for EventContext { type Module = RemoteModule; } impl __sdk::DbContext for EventContext { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl __sdk::EventContext for EventContext {} /// An [`__sdk::DbContext`] augmented with a [`__sdk::ReducerEvent`], /// passed to on-reducer callbacks. pub struct ReducerEventContext { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, /// The event which caused these callbacks to run. pub event: __sdk::ReducerEvent, imp: __sdk::DbContextImpl, } impl __sdk::AbstractEventContext for ReducerEventContext { type Event = __sdk::ReducerEvent; fn event(&self) -> &Self::Event { &self.event } fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, event, imp, } } } impl __sdk::InModule for ReducerEventContext { type Module = RemoteModule; } impl __sdk::DbContext for ReducerEventContext { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl __sdk::ReducerEventContext for ReducerEventContext {} /// An [`__sdk::DbContext`] passed to procedure callbacks. pub struct ProcedureEventContext { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, imp: __sdk::DbContextImpl, } impl __sdk::AbstractEventContext for ProcedureEventContext { type Event = (); fn event(&self) -> &Self::Event { &() } fn new(imp: __sdk::DbContextImpl, _event: Self::Event) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, imp, } } } impl __sdk::InModule for ProcedureEventContext { type Module = RemoteModule; } impl __sdk::DbContext for ProcedureEventContext { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl __sdk::ProcedureEventContext for ProcedureEventContext {} /// An [`__sdk::DbContext`] passed to [`__sdk::SubscriptionBuilder::on_applied`] and [`SubscriptionHandle::unsubscribe_then`] callbacks. pub struct SubscriptionEventContext { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, imp: __sdk::DbContextImpl, } impl __sdk::AbstractEventContext for SubscriptionEventContext { type Event = (); fn event(&self) -> &Self::Event { &() } fn new(imp: __sdk::DbContextImpl, _event: Self::Event) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, imp, } } } impl __sdk::InModule for SubscriptionEventContext { type Module = RemoteModule; } impl __sdk::DbContext for SubscriptionEventContext { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl __sdk::SubscriptionEventContext for SubscriptionEventContext {} /// An [`__sdk::DbContext`] augmented with a [`__sdk::Error`], /// passed to [`__sdk::DbConnectionBuilder::on_disconnect`], [`__sdk::DbConnectionBuilder::on_connect_error`] and [`__sdk::SubscriptionBuilder::on_error`] callbacks. pub struct ErrorContext { /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. pub db: RemoteTables, /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. pub reducers: RemoteReducers, /// Access to setting the call-flags of each reducer defined for each reducer defined by the module /// via extension traits implemented for [`SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub set_reducer_flags: SetReducerFlags, /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. pub procedures: RemoteProcedures, /// The event which caused these callbacks to run. pub event: Option<__sdk::Error>, imp: __sdk::DbContextImpl, } impl __sdk::AbstractEventContext for ErrorContext { type Event = Option<__sdk::Error>; fn event(&self) -> &Self::Event { &self.event } fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { Self { db: RemoteTables { imp: imp.clone() }, reducers: RemoteReducers { imp: imp.clone() }, set_reducer_flags: SetReducerFlags { imp: imp.clone() }, procedures: RemoteProcedures { imp: imp.clone() }, event, imp, } } } impl __sdk::InModule for ErrorContext { type Module = RemoteModule; } impl __sdk::DbContext for ErrorContext { type DbView = RemoteTables; type Reducers = RemoteReducers; type Procedures = RemoteProcedures; type SetReducerFlags = SetReducerFlags; fn db(&self) -> &Self::DbView { &self.db } fn reducers(&self) -> &Self::Reducers { &self.reducers } fn procedures(&self) -> &Self::Procedures { &self.procedures } fn set_reducer_flags(&self) -> &Self::SetReducerFlags { &self.set_reducer_flags } fn is_active(&self) -> bool { self.imp.is_active() } fn disconnect(&self) -> __sdk::Result<()> { self.imp.disconnect() } type SubscriptionBuilder = __sdk::SubscriptionBuilder; fn subscription_builder(&self) -> Self::SubscriptionBuilder { __sdk::SubscriptionBuilder::new(&self.imp) } fn try_identity(&self) -> Option<__sdk::Identity> { self.imp.try_identity() } fn connection_id(&self) -> __sdk::ConnectionId { self.imp.connection_id() } fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { self.imp.try_connection_id() } } impl __sdk::ErrorContext for ErrorContext {} impl __sdk::SpacetimeModule for RemoteModule { type DbConnection = DbConnection; type EventContext = EventContext; type ReducerEventContext = ReducerEventContext; type ProcedureEventContext = ProcedureEventContext; type SubscriptionEventContext = SubscriptionEventContext; type ErrorContext = ErrorContext; type Reducer = Reducer; type DbView = RemoteTables; type Reducers = RemoteReducers; type SetReducerFlags = SetReducerFlags; type DbUpdate = DbUpdate; type AppliedDiff<'r> = AppliedDiff<'r>; type SubscriptionHandle = SubscriptionHandle; type QueryBuilder = __sdk::QueryBuilder; fn register_tables(client_cache: &mut __sdk::ClientCache) { has_special_stuff_table::register_table(client_cache); logged_out_player_table::register_table(client_cache); my_player_table::register_table(client_cache); person_table::register_table(client_cache); pk_multi_identity_table::register_table(client_cache); player_table::register_table(client_cache); points_table::register_table(client_cache); private_table_table::register_table(client_cache); repeating_test_arg_table::register_table(client_cache); table_to_remove_table::register_table(client_cache); test_a_table::register_table(client_cache); test_d_table::register_table(client_cache); test_e_table::register_table(client_cache); test_f_table::register_table(client_cache); } } ''' "my_player_table.rs" = ''' // 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_type::Player; /// Table handle for the table `my_player`. /// /// Obtain a handle from the [`MyPlayerTableAccess::my_player`] method on [`super::RemoteTables`], /// like `ctx.db.my_player()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.my_player().on_insert(...)`. pub struct MyPlayerTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `my_player`. /// /// Implemented for [`super::RemoteTables`]. pub trait MyPlayerTableAccess { #[allow(non_snake_case)] /// Obtain a [`MyPlayerTableHandle`], which mediates access to the table `my_player`. fn my_player(&self) -> MyPlayerTableHandle<'_>; } impl MyPlayerTableAccess for super::RemoteTables { fn my_player(&self) -> MyPlayerTableHandle<'_> { MyPlayerTableHandle { imp: self.imp.get_table::("my_player"), ctx: std::marker::PhantomData, } } } pub struct MyPlayerInsertCallbackId(__sdk::CallbackId); pub struct MyPlayerDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for MyPlayerTableHandle<'ctx> { type Row = Player; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = MyPlayerInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> MyPlayerInsertCallbackId { MyPlayerInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: MyPlayerInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = MyPlayerDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> MyPlayerDeleteCallbackId { MyPlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: MyPlayerDeleteCallbackId) { 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::("my_player"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `Player`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait my_playerQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `Player`. fn my_player(&self) -> __sdk::__query_builder::Table; } impl my_playerQueryTableAccess for __sdk::QueryTableAccessor { fn my_player(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("my_player") } } ''' "namespace_test_c_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] #[derive(Copy, Eq, Hash)] pub enum NamespaceTestC { Foo, Bar, } impl __sdk::InModule for NamespaceTestC { type Module = super::RemoteModule; } ''' "namespace_test_f_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub enum NamespaceTestF { Foo, Bar, Baz(String), } impl __sdk::InModule for NamespaceTestF { type Module = super::RemoteModule; } ''' "person_table.rs" = ''' // 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::person_type::Person; /// Table handle for the table `person`. /// /// Obtain a handle from the [`PersonTableAccess::person`] method on [`super::RemoteTables`], /// like `ctx.db.person()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.person().on_insert(...)`. pub struct PersonTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `person`. /// /// Implemented for [`super::RemoteTables`]. pub trait PersonTableAccess { #[allow(non_snake_case)] /// Obtain a [`PersonTableHandle`], which mediates access to the table `person`. fn person(&self) -> PersonTableHandle<'_>; } impl PersonTableAccess for super::RemoteTables { fn person(&self) -> PersonTableHandle<'_> { PersonTableHandle { imp: self.imp.get_table::("person"), ctx: std::marker::PhantomData, } } } pub struct PersonInsertCallbackId(__sdk::CallbackId); pub struct PersonDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PersonTableHandle<'ctx> { type Row = Person; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PersonInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PersonInsertCallbackId { PersonInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PersonInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PersonDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PersonDeleteCallbackId { PersonDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PersonDeleteCallbackId) { 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::("person"); _table.add_unique_constraint::("id", |row| &row.id); } pub struct PersonUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for PersonTableHandle<'ctx> { type UpdateCallbackId = PersonUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> PersonUpdateCallbackId { PersonUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: PersonUpdateCallbackId) { 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 `person`, /// which allows point queries on the field of the same name /// via the [`PersonIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.person().id().find(...)`. pub struct PersonIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PersonTableHandle<'ctx> { /// Get a handle on the `id` unique index on the table `person`. pub fn id(&self) -> PersonIdUnique<'ctx> { PersonIdUnique { imp: self.imp.get_unique_constraint::("id"), phantom: std::marker::PhantomData, } } } impl<'ctx> PersonIdUnique<'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) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `Person`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait personQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `Person`. fn person(&self) -> __sdk::__query_builder::Table; } impl personQueryTableAccess for __sdk::QueryTableAccessor { fn person(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("person") } } ''' "person_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Person { pub id: u32, pub name: String, pub age: u8, } impl __sdk::InModule for Person { type Module = super::RemoteModule; } /// Column accessor struct for the table `Person`. /// /// Provides typed access to columns for query building. pub struct PersonCols { pub id: __sdk::__query_builder::Col, pub name: __sdk::__query_builder::Col, pub age: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for Person { type Cols = PersonCols; fn cols(table_name: &'static str) -> Self::Cols { PersonCols { id: __sdk::__query_builder::Col::new(table_name, "id"), name: __sdk::__query_builder::Col::new(table_name, "name"), age: __sdk::__query_builder::Col::new(table_name, "age"), } } } /// Indexed column accessor struct for the table `Person`. /// /// Provides typed access to indexed columns for query building. pub struct PersonIxCols { pub age: __sdk::__query_builder::IxCol, pub id: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for Person { type IxCols = PersonIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { PersonIxCols { age: __sdk::__query_builder::IxCol::new(table_name, "age"), id: __sdk::__query_builder::IxCol::new(table_name, "id"), } } } ''' "pk_multi_identity_table.rs" = ''' // 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::pk_multi_identity_type::PkMultiIdentity; /// Table handle for the table `pk_multi_identity`. /// /// Obtain a handle from the [`PkMultiIdentityTableAccess::pk_multi_identity`] method on [`super::RemoteTables`], /// like `ctx.db.pk_multi_identity()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.pk_multi_identity().on_insert(...)`. pub struct PkMultiIdentityTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `pk_multi_identity`. /// /// Implemented for [`super::RemoteTables`]. pub trait PkMultiIdentityTableAccess { #[allow(non_snake_case)] /// Obtain a [`PkMultiIdentityTableHandle`], which mediates access to the table `pk_multi_identity`. fn pk_multi_identity(&self) -> PkMultiIdentityTableHandle<'_>; } impl PkMultiIdentityTableAccess for super::RemoteTables { fn pk_multi_identity(&self) -> PkMultiIdentityTableHandle<'_> { PkMultiIdentityTableHandle { imp: self.imp.get_table::("pk_multi_identity"), ctx: std::marker::PhantomData, } } } pub struct PkMultiIdentityInsertCallbackId(__sdk::CallbackId); pub struct PkMultiIdentityDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PkMultiIdentityTableHandle<'ctx> { type Row = PkMultiIdentity; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PkMultiIdentityInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PkMultiIdentityInsertCallbackId { PkMultiIdentityInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PkMultiIdentityInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PkMultiIdentityDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PkMultiIdentityDeleteCallbackId { PkMultiIdentityDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PkMultiIdentityDeleteCallbackId) { 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::("pk_multi_identity"); _table.add_unique_constraint::("id", |row| &row.id); _table.add_unique_constraint::("other", |row| &row.other); } pub struct PkMultiIdentityUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for PkMultiIdentityTableHandle<'ctx> { type UpdateCallbackId = PkMultiIdentityUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> PkMultiIdentityUpdateCallbackId { PkMultiIdentityUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: PkMultiIdentityUpdateCallbackId) { 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 `pk_multi_identity`, /// which allows point queries on the field of the same name /// via the [`PkMultiIdentityIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.pk_multi_identity().id().find(...)`. pub struct PkMultiIdentityIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PkMultiIdentityTableHandle<'ctx> { /// Get a handle on the `id` unique index on the table `pk_multi_identity`. pub fn id(&self) -> PkMultiIdentityIdUnique<'ctx> { PkMultiIdentityIdUnique { imp: self.imp.get_unique_constraint::("id"), phantom: std::marker::PhantomData, } } } impl<'ctx> PkMultiIdentityIdUnique<'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 `other` unique index on the table `pk_multi_identity`, /// which allows point queries on the field of the same name /// via the [`PkMultiIdentityOtherUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.pk_multi_identity().other().find(...)`. pub struct PkMultiIdentityOtherUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PkMultiIdentityTableHandle<'ctx> { /// Get a handle on the `other` unique index on the table `pk_multi_identity`. pub fn other(&self) -> PkMultiIdentityOtherUnique<'ctx> { PkMultiIdentityOtherUnique { imp: self.imp.get_unique_constraint::("other"), phantom: std::marker::PhantomData, } } } impl<'ctx> PkMultiIdentityOtherUnique<'ctx> { /// Find the subscribed row whose `other` 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) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `PkMultiIdentity`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait pk_multi_identityQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `PkMultiIdentity`. fn pk_multi_identity(&self) -> __sdk::__query_builder::Table; } impl pk_multi_identityQueryTableAccess for __sdk::QueryTableAccessor { fn pk_multi_identity(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("pk_multi_identity") } } ''' "pk_multi_identity_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct PkMultiIdentity { pub id: u32, pub other: u32, } impl __sdk::InModule for PkMultiIdentity { type Module = super::RemoteModule; } /// Column accessor struct for the table `PkMultiIdentity`. /// /// Provides typed access to columns for query building. pub struct PkMultiIdentityCols { pub id: __sdk::__query_builder::Col, pub other: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for PkMultiIdentity { type Cols = PkMultiIdentityCols; fn cols(table_name: &'static str) -> Self::Cols { PkMultiIdentityCols { id: __sdk::__query_builder::Col::new(table_name, "id"), other: __sdk::__query_builder::Col::new(table_name, "other"), } } } /// Indexed column accessor struct for the table `PkMultiIdentity`. /// /// Provides typed access to indexed columns for query building. pub struct PkMultiIdentityIxCols { pub id: __sdk::__query_builder::IxCol, pub other: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for PkMultiIdentity { type IxCols = PkMultiIdentityIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { PkMultiIdentityIxCols { id: __sdk::__query_builder::IxCol::new(table_name, "id"), other: __sdk::__query_builder::IxCol::new(table_name, "other"), } } } ''' "player_table.rs" = ''' // 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_type::Player; /// Table handle for the table `player`. /// /// Obtain a handle from the [`PlayerTableAccess::player`] method on [`super::RemoteTables`], /// like `ctx.db.player()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player().on_insert(...)`. pub struct PlayerTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `player`. /// /// Implemented for [`super::RemoteTables`]. pub trait PlayerTableAccess { #[allow(non_snake_case)] /// Obtain a [`PlayerTableHandle`], which mediates access to the table `player`. fn player(&self) -> PlayerTableHandle<'_>; } impl PlayerTableAccess for super::RemoteTables { fn player(&self) -> PlayerTableHandle<'_> { PlayerTableHandle { imp: self.imp.get_table::("player"), ctx: std::marker::PhantomData, } } } pub struct PlayerInsertCallbackId(__sdk::CallbackId); pub struct PlayerDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> { type Row = Player; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PlayerInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PlayerInsertCallbackId { PlayerInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PlayerInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PlayerDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PlayerDeleteCallbackId { PlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PlayerDeleteCallbackId) { 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"); _table.add_unique_constraint::<__sdk::Identity>("identity", |row| &row.identity); _table.add_unique_constraint::("player_id", |row| &row.player_id); _table.add_unique_constraint::("name", |row| &row.name); } pub struct PlayerUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for PlayerTableHandle<'ctx> { type UpdateCallbackId = PlayerUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> PlayerUpdateCallbackId { PlayerUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: PlayerUpdateCallbackId) { 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 `identity` unique index on the table `player`, /// which allows point queries on the field of the same name /// via the [`PlayerIdentityUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player().identity().find(...)`. pub struct PlayerIdentityUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PlayerTableHandle<'ctx> { /// Get a handle on the `identity` unique index on the table `player`. pub fn identity(&self) -> PlayerIdentityUnique<'ctx> { PlayerIdentityUnique { imp: self.imp.get_unique_constraint::<__sdk::Identity>("identity"), phantom: std::marker::PhantomData, } } } impl<'ctx> PlayerIdentityUnique<'ctx> { /// Find the subscribed row whose `identity` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &__sdk::Identity) -> Option { self.imp.find(col_val) } } /// Access to the `player_id` unique index on the table `player`, /// which allows point queries on the field of the same name /// via the [`PlayerPlayerIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player().player_id().find(...)`. pub struct PlayerPlayerIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PlayerTableHandle<'ctx> { /// Get a handle on the `player_id` unique index on the table `player`. pub fn player_id(&self) -> PlayerPlayerIdUnique<'ctx> { PlayerPlayerIdUnique { imp: self.imp.get_unique_constraint::("player_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> PlayerPlayerIdUnique<'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: &u64) -> Option { self.imp.find(col_val) } } /// Access to the `name` unique index on the table `player`, /// which allows point queries on the field of the same name /// via the [`PlayerNameUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.player().name().find(...)`. pub struct PlayerNameUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> PlayerTableHandle<'ctx> { /// Get a handle on the `name` unique index on the table `player`. pub fn name(&self) -> PlayerNameUnique<'ctx> { PlayerNameUnique { imp: self.imp.get_unique_constraint::("name"), phantom: std::marker::PhantomData, } } } impl<'ctx> PlayerNameUnique<'ctx> { /// Find the subscribed row whose `name` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &String) -> Option { self.imp.find(col_val) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `Player`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait playerQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `Player`. fn player(&self) -> __sdk::__query_builder::Table; } impl playerQueryTableAccess for __sdk::QueryTableAccessor { fn player(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("player") } } ''' "player_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Player { pub identity: __sdk::Identity, pub player_id: u64, pub name: String, } impl __sdk::InModule for Player { type Module = super::RemoteModule; } /// Column accessor struct for the table `Player`. /// /// Provides typed access to columns for query building. pub struct PlayerCols { pub identity: __sdk::__query_builder::Col, pub player_id: __sdk::__query_builder::Col, pub name: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for Player { type Cols = PlayerCols; fn cols(table_name: &'static str) -> Self::Cols { PlayerCols { identity: __sdk::__query_builder::Col::new(table_name, "identity"), player_id: __sdk::__query_builder::Col::new(table_name, "player_id"), name: __sdk::__query_builder::Col::new(table_name, "name"), } } } /// Indexed column accessor struct for the table `Player`. /// /// Provides typed access to indexed columns for query building. pub struct PlayerIxCols { pub identity: __sdk::__query_builder::IxCol, pub name: __sdk::__query_builder::IxCol, pub player_id: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for Player { type IxCols = PlayerIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { PlayerIxCols { identity: __sdk::__query_builder::IxCol::new(table_name, "identity"), name: __sdk::__query_builder::IxCol::new(table_name, "name"), player_id: __sdk::__query_builder::IxCol::new(table_name, "player_id"), } } } ''' "point_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct Point { pub x: i64, pub y: i64, } impl __sdk::InModule for Point { type Module = super::RemoteModule; } /// Column accessor struct for the table `Point`. /// /// Provides typed access to columns for query building. pub struct PointCols { pub x: __sdk::__query_builder::Col, pub y: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for Point { type Cols = PointCols; fn cols(table_name: &'static str) -> Self::Cols { PointCols { x: __sdk::__query_builder::Col::new(table_name, "x"), y: __sdk::__query_builder::Col::new(table_name, "y"), } } } /// Indexed column accessor struct for the table `Point`. /// /// Provides typed access to indexed columns for query building. pub struct PointIxCols { } impl __sdk::__query_builder::HasIxCols for Point { type IxCols = PointIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { PointIxCols { } } } ''' "points_table.rs" = ''' // 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::point_type::Point; /// Table handle for the table `points`. /// /// Obtain a handle from the [`PointsTableAccess::points`] method on [`super::RemoteTables`], /// like `ctx.db.points()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.points().on_insert(...)`. pub struct PointsTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `points`. /// /// Implemented for [`super::RemoteTables`]. pub trait PointsTableAccess { #[allow(non_snake_case)] /// Obtain a [`PointsTableHandle`], which mediates access to the table `points`. fn points(&self) -> PointsTableHandle<'_>; } impl PointsTableAccess for super::RemoteTables { fn points(&self) -> PointsTableHandle<'_> { PointsTableHandle { imp: self.imp.get_table::("points"), ctx: std::marker::PhantomData, } } } pub struct PointsInsertCallbackId(__sdk::CallbackId); pub struct PointsDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PointsTableHandle<'ctx> { type Row = Point; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PointsInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PointsInsertCallbackId { PointsInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PointsInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PointsDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PointsDeleteCallbackId { PointsDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PointsDeleteCallbackId) { 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::("points"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `Point`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait pointsQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `Point`. fn points(&self) -> __sdk::__query_builder::Table; } impl pointsQueryTableAccess for __sdk::QueryTableAccessor { fn points(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("points") } } ''' "private_table_table.rs" = ''' // 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::private_table_type::PrivateTable; /// Table handle for the table `private_table`. /// /// Obtain a handle from the [`PrivateTableTableAccess::private_table`] method on [`super::RemoteTables`], /// like `ctx.db.private_table()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.private_table().on_insert(...)`. pub struct PrivateTableTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `private_table`. /// /// Implemented for [`super::RemoteTables`]. pub trait PrivateTableTableAccess { #[allow(non_snake_case)] /// Obtain a [`PrivateTableTableHandle`], which mediates access to the table `private_table`. fn private_table(&self) -> PrivateTableTableHandle<'_>; } impl PrivateTableTableAccess for super::RemoteTables { fn private_table(&self) -> PrivateTableTableHandle<'_> { PrivateTableTableHandle { imp: self.imp.get_table::("private_table"), ctx: std::marker::PhantomData, } } } pub struct PrivateTableInsertCallbackId(__sdk::CallbackId); pub struct PrivateTableDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for PrivateTableTableHandle<'ctx> { type Row = PrivateTable; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = PrivateTableInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PrivateTableInsertCallbackId { PrivateTableInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: PrivateTableInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = PrivateTableDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> PrivateTableDeleteCallbackId { PrivateTableDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: PrivateTableDeleteCallbackId) { 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::("private_table"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `PrivateTable`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait private_tableQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `PrivateTable`. fn private_table(&self) -> __sdk::__query_builder::Table; } impl private_tableQueryTableAccess for __sdk::QueryTableAccessor { fn private_table(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("private_table") } } ''' "private_table_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct PrivateTable { pub name: String, } impl __sdk::InModule for PrivateTable { type Module = super::RemoteModule; } /// Column accessor struct for the table `PrivateTable`. /// /// Provides typed access to columns for query building. pub struct PrivateTableCols { pub name: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for PrivateTable { type Cols = PrivateTableCols; fn cols(table_name: &'static str) -> Self::Cols { PrivateTableCols { name: __sdk::__query_builder::Col::new(table_name, "name"), } } } /// Indexed column accessor struct for the table `PrivateTable`. /// /// Provides typed access to indexed columns for query building. pub struct PrivateTableIxCols { } impl __sdk::__query_builder::HasIxCols for PrivateTable { type IxCols = PrivateTableIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { PrivateTableIxCols { } } } ''' "query_private_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct QueryPrivateArgs { } impl From for super::Reducer { fn from(args: QueryPrivateArgs) -> Self { Self::QueryPrivate } } impl __sdk::InModule for QueryPrivateArgs { type Module = super::RemoteModule; } pub struct QueryPrivateCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `query_private`. /// /// Implemented for [`super::RemoteReducers`]. pub trait query_private { /// Request that the remote module invoke the reducer `query_private` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_query_private`] callbacks. fn query_private(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `query_private`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`QueryPrivateCallbackId`] can be passed to [`Self::remove_on_query_private`] /// to cancel the callback. fn on_query_private(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> QueryPrivateCallbackId; /// Cancel a callback previously registered by [`Self::on_query_private`], /// causing it not to run in the future. fn remove_on_query_private(&self, callback: QueryPrivateCallbackId); } impl query_private for super::RemoteReducers { fn query_private(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("query_private", QueryPrivateArgs { }) } fn on_query_private( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> QueryPrivateCallbackId { QueryPrivateCallbackId(self.imp.on_reducer( "query_private", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::QueryPrivate { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_query_private(&self, callback: QueryPrivateCallbackId) { self.imp.remove_on_reducer("query_private", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `query_private`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_query_private { /// Set the call-reducer flags for the reducer `query_private` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn query_private(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_query_private for super::SetReducerFlags { fn query_private(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("query_private", flags); } } ''' "remove_table_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct RemoveTable { pub id: u32, } impl __sdk::InModule for RemoveTable { type Module = super::RemoteModule; } /// Column accessor struct for the table `RemoveTable`. /// /// Provides typed access to columns for query building. pub struct RemoveTableCols { pub id: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for RemoveTable { type Cols = RemoveTableCols; fn cols(table_name: &'static str) -> Self::Cols { RemoveTableCols { id: __sdk::__query_builder::Col::new(table_name, "id"), } } } /// Indexed column accessor struct for the table `RemoveTable`. /// /// Provides typed access to indexed columns for query building. pub struct RemoveTableIxCols { } impl __sdk::__query_builder::HasIxCols for RemoveTable { type IxCols = RemoveTableIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { RemoveTableIxCols { } } } ''' "repeating_test_arg_table.rs" = ''' // 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::repeating_test_arg_type::RepeatingTestArg; /// Table handle for the table `repeating_test_arg`. /// /// Obtain a handle from the [`RepeatingTestArgTableAccess::repeating_test_arg`] method on [`super::RemoteTables`], /// like `ctx.db.repeating_test_arg()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.repeating_test_arg().on_insert(...)`. pub struct RepeatingTestArgTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `repeating_test_arg`. /// /// Implemented for [`super::RemoteTables`]. pub trait RepeatingTestArgTableAccess { #[allow(non_snake_case)] /// Obtain a [`RepeatingTestArgTableHandle`], which mediates access to the table `repeating_test_arg`. fn repeating_test_arg(&self) -> RepeatingTestArgTableHandle<'_>; } impl RepeatingTestArgTableAccess for super::RemoteTables { fn repeating_test_arg(&self) -> RepeatingTestArgTableHandle<'_> { RepeatingTestArgTableHandle { imp: self.imp.get_table::("repeating_test_arg"), ctx: std::marker::PhantomData, } } } pub struct RepeatingTestArgInsertCallbackId(__sdk::CallbackId); pub struct RepeatingTestArgDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for RepeatingTestArgTableHandle<'ctx> { type Row = RepeatingTestArg; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = RepeatingTestArgInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> RepeatingTestArgInsertCallbackId { RepeatingTestArgInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: RepeatingTestArgInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = RepeatingTestArgDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> RepeatingTestArgDeleteCallbackId { RepeatingTestArgDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: RepeatingTestArgDeleteCallbackId) { 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::("repeating_test_arg"); _table.add_unique_constraint::("scheduled_id", |row| &row.scheduled_id); } pub struct RepeatingTestArgUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for RepeatingTestArgTableHandle<'ctx> { type UpdateCallbackId = RepeatingTestArgUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> RepeatingTestArgUpdateCallbackId { RepeatingTestArgUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: RepeatingTestArgUpdateCallbackId) { 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 `scheduled_id` unique index on the table `repeating_test_arg`, /// which allows point queries on the field of the same name /// via the [`RepeatingTestArgScheduledIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.repeating_test_arg().scheduled_id().find(...)`. pub struct RepeatingTestArgScheduledIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> RepeatingTestArgTableHandle<'ctx> { /// Get a handle on the `scheduled_id` unique index on the table `repeating_test_arg`. pub fn scheduled_id(&self) -> RepeatingTestArgScheduledIdUnique<'ctx> { RepeatingTestArgScheduledIdUnique { imp: self.imp.get_unique_constraint::("scheduled_id"), phantom: std::marker::PhantomData, } } } impl<'ctx> RepeatingTestArgScheduledIdUnique<'ctx> { /// Find the subscribed row whose `scheduled_id` column value is equal to `col_val`, /// if such a row is present in the client cache. pub fn find(&self, col_val: &u64) -> Option { self.imp.find(col_val) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `RepeatingTestArg`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait repeating_test_argQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `RepeatingTestArg`. fn repeating_test_arg(&self) -> __sdk::__query_builder::Table; } impl repeating_test_argQueryTableAccess for __sdk::QueryTableAccessor { fn repeating_test_arg(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("repeating_test_arg") } } ''' "repeating_test_arg_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct RepeatingTestArg { pub scheduled_id: u64, pub scheduled_at: __sdk::ScheduleAt, pub prev_time: __sdk::Timestamp, } impl __sdk::InModule for RepeatingTestArg { type Module = super::RemoteModule; } /// Column accessor struct for the table `RepeatingTestArg`. /// /// Provides typed access to columns for query building. pub struct RepeatingTestArgCols { pub scheduled_id: __sdk::__query_builder::Col, pub scheduled_at: __sdk::__query_builder::Col, pub prev_time: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for RepeatingTestArg { type Cols = RepeatingTestArgCols; fn cols(table_name: &'static str) -> Self::Cols { RepeatingTestArgCols { scheduled_id: __sdk::__query_builder::Col::new(table_name, "scheduled_id"), scheduled_at: __sdk::__query_builder::Col::new(table_name, "scheduled_at"), prev_time: __sdk::__query_builder::Col::new(table_name, "prev_time"), } } } /// Indexed column accessor struct for the table `RepeatingTestArg`. /// /// Provides typed access to indexed columns for query building. pub struct RepeatingTestArgIxCols { pub scheduled_id: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for RepeatingTestArg { type IxCols = RepeatingTestArgIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { RepeatingTestArgIxCols { scheduled_id: __sdk::__query_builder::IxCol::new(table_name, "scheduled_id"), } } } ''' "repeating_test_reducer.rs" = ''' // 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::repeating_test_arg_type::RepeatingTestArg; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct RepeatingTestArgs { pub arg: RepeatingTestArg, } impl From for super::Reducer { fn from(args: RepeatingTestArgs) -> Self { Self::RepeatingTest { arg: args.arg, } } } impl __sdk::InModule for RepeatingTestArgs { type Module = super::RemoteModule; } pub struct RepeatingTestCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `repeating_test`. /// /// Implemented for [`super::RemoteReducers`]. pub trait repeating_test { /// Request that the remote module invoke the reducer `repeating_test` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_repeating_test`] callbacks. fn repeating_test(&self, arg: RepeatingTestArg, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `repeating_test`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`RepeatingTestCallbackId`] can be passed to [`Self::remove_on_repeating_test`] /// to cancel the callback. fn on_repeating_test(&self, callback: impl FnMut(&super::ReducerEventContext, &RepeatingTestArg, ) + Send + 'static) -> RepeatingTestCallbackId; /// Cancel a callback previously registered by [`Self::on_repeating_test`], /// causing it not to run in the future. fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId); } impl repeating_test for super::RemoteReducers { fn repeating_test(&self, arg: RepeatingTestArg, ) -> __sdk::Result<()> { self.imp.call_reducer("repeating_test", RepeatingTestArgs { arg, }) } fn on_repeating_test( &self, mut callback: impl FnMut(&super::ReducerEventContext, &RepeatingTestArg, ) + Send + 'static, ) -> RepeatingTestCallbackId { RepeatingTestCallbackId(self.imp.on_reducer( "repeating_test", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::RepeatingTest { arg, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, arg, ) }), )) } fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId) { self.imp.remove_on_reducer("repeating_test", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `repeating_test`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_repeating_test { /// Set the call-reducer flags for the reducer `repeating_test` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn repeating_test(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_repeating_test for super::SetReducerFlags { fn repeating_test(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("repeating_test", flags); } } ''' "return_value_procedure.rs" = ''' // 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::baz_type::Baz; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] struct ReturnValueArgs { pub foo: u64, } impl __sdk::InModule for ReturnValueArgs { type Module = super::RemoteModule; } #[allow(non_camel_case_types)] /// Extension trait for access to the procedure `return_value`. /// /// Implemented for [`super::RemoteProcedures`]. pub trait return_value { fn return_value(&self, foo: u64, ) { self.return_value_then(foo, |_, _| {}); } fn return_value_then( &self, foo: u64, __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, ); } impl return_value for super::RemoteProcedures { fn return_value_then( &self, foo: u64, __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, ) { self.imp.invoke_procedure_with_callback::<_, Baz>( "return_value", ReturnValueArgs { foo, }, __callback, ); } } ''' "say_hello_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct SayHelloArgs { } impl From for super::Reducer { fn from(args: SayHelloArgs) -> Self { Self::SayHello } } impl __sdk::InModule for SayHelloArgs { type Module = super::RemoteModule; } pub struct SayHelloCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `say_hello`. /// /// Implemented for [`super::RemoteReducers`]. pub trait say_hello { /// Request that the remote module invoke the reducer `say_hello` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_say_hello`] callbacks. fn say_hello(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `say_hello`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`SayHelloCallbackId`] can be passed to [`Self::remove_on_say_hello`] /// to cancel the callback. fn on_say_hello(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> SayHelloCallbackId; /// Cancel a callback previously registered by [`Self::on_say_hello`], /// causing it not to run in the future. fn remove_on_say_hello(&self, callback: SayHelloCallbackId); } impl say_hello for super::RemoteReducers { fn say_hello(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("say_hello", SayHelloArgs { }) } fn on_say_hello( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> SayHelloCallbackId { SayHelloCallbackId(self.imp.on_reducer( "say_hello", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::SayHello { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_say_hello(&self, callback: SayHelloCallbackId) { self.imp.remove_on_reducer("say_hello", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `say_hello`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_say_hello { /// Set the call-reducer flags for the reducer `say_hello` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn say_hello(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_say_hello for super::SetReducerFlags { fn say_hello(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("say_hello", flags); } } ''' "sleep_one_second_procedure.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] struct SleepOneSecondArgs { } impl __sdk::InModule for SleepOneSecondArgs { type Module = super::RemoteModule; } #[allow(non_camel_case_types)] /// Extension trait for access to the procedure `sleep_one_second`. /// /// Implemented for [`super::RemoteProcedures`]. pub trait sleep_one_second { fn sleep_one_second(&self, ) { self.sleep_one_second_then( |_, _| {}); } fn sleep_one_second_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, ); } impl sleep_one_second for super::RemoteProcedures { fn sleep_one_second_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, ) { self.imp.invoke_procedure_with_callback::<_, ()>( "sleep_one_second", SleepOneSecondArgs { }, __callback, ); } } ''' "table_to_remove_table.rs" = ''' // 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::remove_table_type::RemoveTable; /// Table handle for the table `table_to_remove`. /// /// Obtain a handle from the [`TableToRemoveTableAccess::table_to_remove`] method on [`super::RemoteTables`], /// like `ctx.db.table_to_remove()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.table_to_remove().on_insert(...)`. pub struct TableToRemoveTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `table_to_remove`. /// /// Implemented for [`super::RemoteTables`]. pub trait TableToRemoveTableAccess { #[allow(non_snake_case)] /// Obtain a [`TableToRemoveTableHandle`], which mediates access to the table `table_to_remove`. fn table_to_remove(&self) -> TableToRemoveTableHandle<'_>; } impl TableToRemoveTableAccess for super::RemoteTables { fn table_to_remove(&self) -> TableToRemoveTableHandle<'_> { TableToRemoveTableHandle { imp: self.imp.get_table::("table_to_remove"), ctx: std::marker::PhantomData, } } } pub struct TableToRemoveInsertCallbackId(__sdk::CallbackId); pub struct TableToRemoveDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TableToRemoveTableHandle<'ctx> { type Row = RemoveTable; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TableToRemoveInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TableToRemoveInsertCallbackId { TableToRemoveInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TableToRemoveInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TableToRemoveDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TableToRemoveDeleteCallbackId { TableToRemoveDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TableToRemoveDeleteCallbackId) { 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::("table_to_remove"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `RemoveTable`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait table_to_removeQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `RemoveTable`. fn table_to_remove(&self) -> __sdk::__query_builder::Table; } impl table_to_removeQueryTableAccess for __sdk::QueryTableAccessor { fn table_to_remove(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("table_to_remove") } } ''' "test_a_table.rs" = ''' // 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::test_a_type::TestA; /// Table handle for the table `test_a`. /// /// Obtain a handle from the [`TestATableAccess::test_a`] method on [`super::RemoteTables`], /// like `ctx.db.test_a()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.test_a().on_insert(...)`. pub struct TestATableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `test_a`. /// /// Implemented for [`super::RemoteTables`]. pub trait TestATableAccess { #[allow(non_snake_case)] /// Obtain a [`TestATableHandle`], which mediates access to the table `test_a`. fn test_a(&self) -> TestATableHandle<'_>; } impl TestATableAccess for super::RemoteTables { fn test_a(&self) -> TestATableHandle<'_> { TestATableHandle { imp: self.imp.get_table::("test_a"), ctx: std::marker::PhantomData, } } } pub struct TestAInsertCallbackId(__sdk::CallbackId); pub struct TestADeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TestATableHandle<'ctx> { type Row = TestA; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TestAInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestAInsertCallbackId { TestAInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TestAInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TestADeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestADeleteCallbackId { TestADeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TestADeleteCallbackId) { 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::("test_a"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `TestA`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait test_aQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `TestA`. fn test_a(&self) -> __sdk::__query_builder::Table; } impl test_aQueryTableAccess for __sdk::QueryTableAccessor { fn test_a(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("test_a") } } ''' "test_a_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct TestA { pub x: u32, pub y: u32, pub z: String, } impl __sdk::InModule for TestA { type Module = super::RemoteModule; } /// Column accessor struct for the table `TestA`. /// /// Provides typed access to columns for query building. pub struct TestACols { pub x: __sdk::__query_builder::Col, pub y: __sdk::__query_builder::Col, pub z: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for TestA { type Cols = TestACols; fn cols(table_name: &'static str) -> Self::Cols { TestACols { x: __sdk::__query_builder::Col::new(table_name, "x"), y: __sdk::__query_builder::Col::new(table_name, "y"), z: __sdk::__query_builder::Col::new(table_name, "z"), } } } /// Indexed column accessor struct for the table `TestA`. /// /// Provides typed access to indexed columns for query building. pub struct TestAIxCols { pub x: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for TestA { type IxCols = TestAIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { TestAIxCols { x: __sdk::__query_builder::IxCol::new(table_name, "x"), } } } ''' "test_b_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct TestB { pub foo: String, } impl __sdk::InModule for TestB { type Module = super::RemoteModule; } ''' "test_btree_index_args_reducer.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct TestBtreeIndexArgsArgs { } impl From for super::Reducer { fn from(args: TestBtreeIndexArgsArgs) -> Self { Self::TestBtreeIndexArgs } } impl __sdk::InModule for TestBtreeIndexArgsArgs { type Module = super::RemoteModule; } pub struct TestBtreeIndexArgsCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `test_btree_index_args`. /// /// Implemented for [`super::RemoteReducers`]. pub trait test_btree_index_args { /// Request that the remote module invoke the reducer `test_btree_index_args` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_test_btree_index_args`] callbacks. fn test_btree_index_args(&self, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `test_btree_index_args`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`TestBtreeIndexArgsCallbackId`] can be passed to [`Self::remove_on_test_btree_index_args`] /// to cancel the callback. fn on_test_btree_index_args(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> TestBtreeIndexArgsCallbackId; /// Cancel a callback previously registered by [`Self::on_test_btree_index_args`], /// causing it not to run in the future. fn remove_on_test_btree_index_args(&self, callback: TestBtreeIndexArgsCallbackId); } impl test_btree_index_args for super::RemoteReducers { fn test_btree_index_args(&self, ) -> __sdk::Result<()> { self.imp.call_reducer("test_btree_index_args", TestBtreeIndexArgsArgs { }) } fn on_test_btree_index_args( &self, mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, ) -> TestBtreeIndexArgsCallbackId { TestBtreeIndexArgsCallbackId(self.imp.on_reducer( "test_btree_index_args", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::TestBtreeIndexArgs { }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, ) }), )) } fn remove_on_test_btree_index_args(&self, callback: TestBtreeIndexArgsCallbackId) { self.imp.remove_on_reducer("test_btree_index_args", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `test_btree_index_args`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_test_btree_index_args { /// Set the call-reducer flags for the reducer `test_btree_index_args` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn test_btree_index_args(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_test_btree_index_args for super::SetReducerFlags { fn test_btree_index_args(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("test_btree_index_args", flags); } } ''' "test_d_table.rs" = ''' // 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::test_d_type::TestD; use super::namespace_test_c_type::NamespaceTestC; /// Table handle for the table `test_d`. /// /// Obtain a handle from the [`TestDTableAccess::test_d`] method on [`super::RemoteTables`], /// like `ctx.db.test_d()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.test_d().on_insert(...)`. pub struct TestDTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `test_d`. /// /// Implemented for [`super::RemoteTables`]. pub trait TestDTableAccess { #[allow(non_snake_case)] /// Obtain a [`TestDTableHandle`], which mediates access to the table `test_d`. fn test_d(&self) -> TestDTableHandle<'_>; } impl TestDTableAccess for super::RemoteTables { fn test_d(&self) -> TestDTableHandle<'_> { TestDTableHandle { imp: self.imp.get_table::("test_d"), ctx: std::marker::PhantomData, } } } pub struct TestDInsertCallbackId(__sdk::CallbackId); pub struct TestDDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TestDTableHandle<'ctx> { type Row = TestD; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TestDInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestDInsertCallbackId { TestDInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TestDInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TestDDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestDDeleteCallbackId { TestDDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TestDDeleteCallbackId) { 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::("test_d"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `TestD`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait test_dQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `TestD`. fn test_d(&self) -> __sdk::__query_builder::Table; } impl test_dQueryTableAccess for __sdk::QueryTableAccessor { fn test_d(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("test_d") } } ''' "test_d_type.rs" = ''' // 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::namespace_test_c_type::NamespaceTestC; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct TestD { pub test_c: Option::, } impl __sdk::InModule for TestD { type Module = super::RemoteModule; } /// Column accessor struct for the table `TestD`. /// /// Provides typed access to columns for query building. pub struct TestDCols { pub test_c: __sdk::__query_builder::Col>, } impl __sdk::__query_builder::HasCols for TestD { type Cols = TestDCols; fn cols(table_name: &'static str) -> Self::Cols { TestDCols { test_c: __sdk::__query_builder::Col::new(table_name, "test_c"), } } } /// Indexed column accessor struct for the table `TestD`. /// /// Provides typed access to indexed columns for query building. pub struct TestDIxCols { } impl __sdk::__query_builder::HasIxCols for TestD { type IxCols = TestDIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { TestDIxCols { } } } ''' "test_e_table.rs" = ''' // 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::test_e_type::TestE; /// Table handle for the table `test_e`. /// /// Obtain a handle from the [`TestETableAccess::test_e`] method on [`super::RemoteTables`], /// like `ctx.db.test_e()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.test_e().on_insert(...)`. pub struct TestETableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `test_e`. /// /// Implemented for [`super::RemoteTables`]. pub trait TestETableAccess { #[allow(non_snake_case)] /// Obtain a [`TestETableHandle`], which mediates access to the table `test_e`. fn test_e(&self) -> TestETableHandle<'_>; } impl TestETableAccess for super::RemoteTables { fn test_e(&self) -> TestETableHandle<'_> { TestETableHandle { imp: self.imp.get_table::("test_e"), ctx: std::marker::PhantomData, } } } pub struct TestEInsertCallbackId(__sdk::CallbackId); pub struct TestEDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TestETableHandle<'ctx> { type Row = TestE; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TestEInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestEInsertCallbackId { TestEInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TestEInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TestEDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestEDeleteCallbackId { TestEDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TestEDeleteCallbackId) { 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::("test_e"); _table.add_unique_constraint::("id", |row| &row.id); } pub struct TestEUpdateCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::TableWithPrimaryKey for TestETableHandle<'ctx> { type UpdateCallbackId = TestEUpdateCallbackId; fn on_update( &self, callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, ) -> TestEUpdateCallbackId { TestEUpdateCallbackId(self.imp.on_update(Box::new(callback))) } fn remove_on_update(&self, callback: TestEUpdateCallbackId) { 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 `test_e`, /// which allows point queries on the field of the same name /// via the [`TestEIdUnique::find`] method. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.test_e().id().find(...)`. pub struct TestEIdUnique<'ctx> { imp: __sdk::UniqueConstraintHandle, phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, } impl<'ctx> TestETableHandle<'ctx> { /// Get a handle on the `id` unique index on the table `test_e`. pub fn id(&self) -> TestEIdUnique<'ctx> { TestEIdUnique { imp: self.imp.get_unique_constraint::("id"), phantom: std::marker::PhantomData, } } } impl<'ctx> TestEIdUnique<'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: &u64) -> Option { self.imp.find(col_val) } } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `TestE`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait test_eQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `TestE`. fn test_e(&self) -> __sdk::__query_builder::Table; } impl test_eQueryTableAccess for __sdk::QueryTableAccessor { fn test_e(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("test_e") } } ''' "test_e_type.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct TestE { pub id: u64, pub name: String, } impl __sdk::InModule for TestE { type Module = super::RemoteModule; } /// Column accessor struct for the table `TestE`. /// /// Provides typed access to columns for query building. pub struct TestECols { pub id: __sdk::__query_builder::Col, pub name: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for TestE { type Cols = TestECols; fn cols(table_name: &'static str) -> Self::Cols { TestECols { id: __sdk::__query_builder::Col::new(table_name, "id"), name: __sdk::__query_builder::Col::new(table_name, "name"), } } } /// Indexed column accessor struct for the table `TestE`. /// /// Provides typed access to indexed columns for query building. pub struct TestEIxCols { pub id: __sdk::__query_builder::IxCol, pub name: __sdk::__query_builder::IxCol, } impl __sdk::__query_builder::HasIxCols for TestE { type IxCols = TestEIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { TestEIxCols { id: __sdk::__query_builder::IxCol::new(table_name, "id"), name: __sdk::__query_builder::IxCol::new(table_name, "name"), } } } ''' "test_f_table.rs" = ''' // 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::test_foobar_type::TestFoobar; use super::foobar_type::Foobar; /// Table handle for the table `test_f`. /// /// Obtain a handle from the [`TestFTableAccess::test_f`] method on [`super::RemoteTables`], /// like `ctx.db.test_f()`. /// /// Users are encouraged not to explicitly reference this type, /// but to directly chain method calls, /// like `ctx.db.test_f().on_insert(...)`. pub struct TestFTableHandle<'ctx> { imp: __sdk::TableHandle, ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, } #[allow(non_camel_case_types)] /// Extension trait for access to the table `test_f`. /// /// Implemented for [`super::RemoteTables`]. pub trait TestFTableAccess { #[allow(non_snake_case)] /// Obtain a [`TestFTableHandle`], which mediates access to the table `test_f`. fn test_f(&self) -> TestFTableHandle<'_>; } impl TestFTableAccess for super::RemoteTables { fn test_f(&self) -> TestFTableHandle<'_> { TestFTableHandle { imp: self.imp.get_table::("test_f"), ctx: std::marker::PhantomData, } } } pub struct TestFInsertCallbackId(__sdk::CallbackId); pub struct TestFDeleteCallbackId(__sdk::CallbackId); impl<'ctx> __sdk::Table for TestFTableHandle<'ctx> { type Row = TestFoobar; type EventContext = super::EventContext; fn count(&self) -> u64 { self.imp.count() } fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } type InsertCallbackId = TestFInsertCallbackId; fn on_insert( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestFInsertCallbackId { TestFInsertCallbackId(self.imp.on_insert(Box::new(callback))) } fn remove_on_insert(&self, callback: TestFInsertCallbackId) { self.imp.remove_on_insert(callback.0) } type DeleteCallbackId = TestFDeleteCallbackId; fn on_delete( &self, callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, ) -> TestFDeleteCallbackId { TestFDeleteCallbackId(self.imp.on_delete(Box::new(callback))) } fn remove_on_delete(&self, callback: TestFDeleteCallbackId) { 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::("test_f"); } #[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() }) } #[allow(non_camel_case_types)] /// Extension trait for query builder access to the table `TestFoobar`. /// /// Implemented for [`__sdk::QueryTableAccessor`]. pub trait test_fQueryTableAccess { #[allow(non_snake_case)] /// Get a query builder for the table `TestFoobar`. fn test_f(&self) -> __sdk::__query_builder::Table; } impl test_fQueryTableAccess for __sdk::QueryTableAccessor { fn test_f(&self) -> __sdk::__query_builder::Table { __sdk::__query_builder::Table::new("test_f") } } ''' "test_foobar_type.rs" = ''' // 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::foobar_type::Foobar; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct TestFoobar { pub field: Foobar, } impl __sdk::InModule for TestFoobar { type Module = super::RemoteModule; } /// Column accessor struct for the table `TestFoobar`. /// /// Provides typed access to columns for query building. pub struct TestFoobarCols { pub field: __sdk::__query_builder::Col, } impl __sdk::__query_builder::HasCols for TestFoobar { type Cols = TestFoobarCols; fn cols(table_name: &'static str) -> Self::Cols { TestFoobarCols { field: __sdk::__query_builder::Col::new(table_name, "field"), } } } /// Indexed column accessor struct for the table `TestFoobar`. /// /// Provides typed access to indexed columns for query building. pub struct TestFoobarIxCols { } impl __sdk::__query_builder::HasIxCols for TestFoobar { type IxCols = TestFoobarIxCols; fn ix_cols(table_name: &'static str) -> Self::IxCols { TestFoobarIxCols { } } } ''' "test_reducer.rs" = ''' // 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::test_a_type::TestA; use super::test_b_type::TestB; use super::namespace_test_c_type::NamespaceTestC; use super::namespace_test_f_type::NamespaceTestF; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub(super) struct TestArgs { pub arg: TestA, pub arg_2: TestB, pub arg_3: NamespaceTestC, pub arg_4: NamespaceTestF, } impl From for super::Reducer { fn from(args: TestArgs) -> Self { Self::Test { arg: args.arg, arg_2: args.arg_2, arg_3: args.arg_3, arg_4: args.arg_4, } } } impl __sdk::InModule for TestArgs { type Module = super::RemoteModule; } pub struct TestCallbackId(__sdk::CallbackId); #[allow(non_camel_case_types)] /// Extension trait for access to the reducer `test`. /// /// Implemented for [`super::RemoteReducers`]. pub trait test { /// Request that the remote module invoke the reducer `test` to run as soon as possible. /// /// This method returns immediately, and errors only if we are unable to send the request. /// The reducer will run asynchronously in the future, /// and its status can be observed by listening for [`Self::on_test`] callbacks. fn test(&self, arg: TestA, arg_2: TestB, arg_3: NamespaceTestC, arg_4: NamespaceTestF, ) -> __sdk::Result<()>; /// Register a callback to run whenever we are notified of an invocation of the reducer `test`. /// /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] /// to determine the reducer's status. /// /// The returned [`TestCallbackId`] can be passed to [`Self::remove_on_test`] /// to cancel the callback. fn on_test(&self, callback: impl FnMut(&super::ReducerEventContext, &TestA, &TestB, &NamespaceTestC, &NamespaceTestF, ) + Send + 'static) -> TestCallbackId; /// Cancel a callback previously registered by [`Self::on_test`], /// causing it not to run in the future. fn remove_on_test(&self, callback: TestCallbackId); } impl test for super::RemoteReducers { fn test(&self, arg: TestA, arg_2: TestB, arg_3: NamespaceTestC, arg_4: NamespaceTestF, ) -> __sdk::Result<()> { self.imp.call_reducer("test", TestArgs { arg, arg_2, arg_3, arg_4, }) } fn on_test( &self, mut callback: impl FnMut(&super::ReducerEventContext, &TestA, &TestB, &NamespaceTestC, &NamespaceTestF, ) + Send + 'static, ) -> TestCallbackId { TestCallbackId(self.imp.on_reducer( "test", Box::new(move |ctx: &super::ReducerEventContext| { #[allow(irrefutable_let_patterns)] let super::ReducerEventContext { event: __sdk::ReducerEvent { reducer: super::Reducer::Test { arg, arg_2, arg_3, arg_4, }, .. }, .. } = ctx else { unreachable!() }; callback(ctx, arg, arg_2, arg_3, arg_4, ) }), )) } fn remove_on_test(&self, callback: TestCallbackId) { self.imp.remove_on_reducer("test", callback.0) } } #[allow(non_camel_case_types)] #[doc(hidden)] /// Extension trait for setting the call-flags for the reducer `test`. /// /// Implemented for [`super::SetReducerFlags`]. /// /// This type is currently unstable and may be removed without a major version bump. pub trait set_flags_for_test { /// Set the call-reducer flags for the reducer `test` to `flags`. /// /// This type is currently unstable and may be removed without a major version bump. fn test(&self, flags: __ws::CallReducerFlags); } impl set_flags_for_test for super::SetReducerFlags { fn test(&self, flags: __ws::CallReducerFlags) { self.imp.set_call_reducer_flags("test", flags); } } ''' "with_tx_procedure.rs" = ''' // 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, }; #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] struct WithTxArgs { } impl __sdk::InModule for WithTxArgs { type Module = super::RemoteModule; } #[allow(non_camel_case_types)] /// Extension trait for access to the procedure `with_tx`. /// /// Implemented for [`super::RemoteProcedures`]. pub trait with_tx { fn with_tx(&self, ) { self.with_tx_then( |_, _| {}); } fn with_tx_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, ); } impl with_tx for super::RemoteProcedures { fn with_tx_then( &self, __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, ) { self.imp.invoke_procedure_with_callback::<_, ()>( "with_tx", WithTxArgs { }, __callback, ); } } '''