You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Called from reducer#[inline(always)]pubfnget_tile(db:&Local,map_id:u32,x:u32,y:u32) -> Option<MapTile>{
db.map_tile().map_tile_idx().filter((map_id, x, y)).next()}// Called from view#[inline(always)]pubfnget_tile_view(db:&LocalReadOnly,map_id:u32,x:u32,y:u32) -> Option<MapTile>{
db.map_tile().map_tile_idx().filter((map_id, x, y)).next()}// Even this will only accept `Local`// Hope to make it work from both view and reducerpubfnget_title2(db:&implmap_tile,map_id:u32,x:u32,y:u32) -> Option<MapTile>{
db.map_tile().map_tile_idx().filter((map_id, x, y)).next()}
That's because you should access .db on it first. It's a context, not a DbView itself!
doesnt work:
ctx: &impl DbContext:
error[E0599]: no method named `map_tile` found for reference `&<impl DbContext as spacetimedb::DbContext>::DbView` in the current scope
--> crates/server/src/map/service.rs:31:18
|
31 | ctx.db().map_tile().map_tile_idx().filter((map_id, x, y)).next()
| ^^^^^^^^ method not found in `&<impl DbContext as spacetimedb::DbContext>::DbView`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `map_tile`, perhaps you need to implement one of them:
candidate #1: `schema::map::map_tile`
candidate #2: `schema::map::map_tile__query`
candidate #3: `schema::map::map_tile__view`
ctx: &(impl DbContext + map_tile):
error[E0599]: no method named `map_tile` found for reference `&<impl DbContext + map_tile as spacetimedb::DbContext>::DbView` in the current scope
--> crates/server/src/map/service.rs:31:18
|
31 | ctx.db().map_tile().map_tile_idx().filter((map_id, x, y)).next()
| --- ^^^^^^^^ method not found in `&<impl DbContext + map_tile as spacetimedb::DbContext>::DbView`
| |
| method `map_tile` is available on `&impl DbContext + map_tile`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `map_tile`, perhaps you need to implement one of them:
candidate #1: `schema::map::map_tile`
candidate #2: `schema::map::map_tile__query`
candidate #3: `schema::map::map_tile__view`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
All reactions