Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong entity id field name #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dojo.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ typedef struct CArray_Model {
} CArray_Model;

typedef struct Entity {
struct FieldElement key;
struct FieldElement id;
struct CArray_Model models;
} Entity;

Expand Down
6 changes: 3 additions & 3 deletions example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ int main()
printf("Fetched %zu entities\n", fetchedEntities.data_len);
for (size_t i = 0; i < fetchedEntities.data_len; i++)
{
// pritn hex of key
printf("Key: 0x");
// pritn hex of id
printf("entity id: 0x");
for (size_t j = 0; j < 32; j++)
{
printf("%02x", fetchedEntities.data[i].key.data[j]);
printf("%02x", fetchedEntities.data[i].id.data[j]);
}
printf("\n");
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ pub unsafe extern "C" fn client_on_entity_state_update(

(*client).runtime.spawn(async move {
while let Some(Ok(entity)) = rcv.next().await {
let key: types::FieldElement = (&entity.key).into();
let id: types::FieldElement = (&entity.id).into();
let models: Vec<Model> = entity.models.into_iter().map(|e| (&e).into()).collect();
callback(key, models.into());
callback(id, models.into());
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pub enum ValueType {
#[derive(Clone, Debug)]
#[repr(C)]
pub struct Entity {
pub key: FieldElement,
pub id: FieldElement,
pub models: CArray<Model>,
}

Expand All @@ -282,7 +282,7 @@ impl From<&Entity> for torii_grpc::types::schema::Entity {
let models = models.iter().map(|m| (&m.clone()).into()).collect();

torii_grpc::types::schema::Entity {
key: (&val.key.clone()).into(),
id: (&val.id.clone()).into(),
models,
}
}
Expand All @@ -297,7 +297,7 @@ impl From<&torii_grpc::types::schema::Entity> for Entity {
.collect::<Vec<Model>>();

Entity {
key: (&val.key.clone()).into(),
id: (&val.id.clone()).into(),
models: models.into(),
}
}
Expand Down
Loading