Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

refactor: refactor Struct and StructValue #136

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

ZENOTME
Copy link
Contributor

@ZENOTME ZENOTME commented Aug 2, 2023

as #135 (comment) says, we should keep type info in struct to be Arc so that these info can be shared if we have many values to reduce memory cost.

This PR:

  1. refactor Struct: Hide this field and expose interface to access it/
  2. refactor StructValue: hold the type info using Arc<Struct>
  3. Make the Struct in Any to be Arc so that we can share the type info when create struct value.
enum Any {
    Struct(Arc<Struct>)
}

format!("Field {} is not found", field_id),
))?;
// TODO: Check the field type is consistent.
// TODO: Check the duplication of field.
Copy link
Contributor Author

@ZENOTME ZENOTME Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two todo check here:

  1. for check field type, Maybe we need to add interface for AnyValue to return the according type like:
impl AnyValue {
    fn return_type(&self) -> Any 
}
  1. Not sure whether we need it🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can postpone the check later.

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@liurenjie1024 liurenjie1024 merged commit a24a567 into icelake-io:main Aug 2, 2023
4 checks passed
@ZENOTME ZENOTME deleted the struct branch August 9, 2023 05:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants