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

MetaInfo: creator is optional now #190

Merged
merged 1 commit into from
Oct 20, 2021
Merged

MetaInfo: creator is optional now #190

merged 1 commit into from
Oct 20, 2021

Conversation

madig
Copy link
Collaborator

@madig madig commented Sep 30, 2021

@github-actions
Copy link

🗜 Bloat check ⚖️

Comparing 3fc3a19 against bfe3f27

target old size new size difference
target/release/examples/load_save 1.8 MB 1.8 MB 80 Bytes (0.00%)
target/debug/examples/load_save 8.46 MB 8.46 MB -296 Bytes (-0.00%)

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

A few thoughts; I don't particularly love this spec change and I don't really like changing a spec without some kind of spec version bump but those things don't matter, but if this is the consensus then let's certainly make the change :)

@@ -77,7 +77,7 @@ fn is_zero(v: &u32) -> bool {
impl Default for MetaInfo {
fn default() -> Self {
MetaInfo {
creator: DEFAULT_METAINFO_CREATOR.to_string(),
creator: Some(DEFAULT_METAINFO_CREATOR.to_string()),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just default to None?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, and set the creator on saving? I'd prefer to keep the explicit norad reference, since norad is the only user of it currently.

@@ -64,7 +64,7 @@ pub enum FormatVersion {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct MetaInfo {
pub creator: String,
pub creator: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

I think this is right, but in line with the other changes you've been making we could also just treat the empty string as none. (I prefer this way, though, it's more explicit and more "correct".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mh, an empty string would still land in the serialized stream unless I stop serde; and the spec doesn't say that the field must be non-empty 🤔

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

looks good!

@chrissimpkins
Copy link
Collaborator

OK to merge?

Base automatically changed from deoptionalize-font to master October 20, 2021 20:51
@madig madig merged commit c60251c into master Oct 20, 2021
@madig madig deleted the optional-creator branch October 20, 2021 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants