Skip to content

Value printing refactor (pretty print structs) #8

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

Merged
merged 14 commits into from
Aug 13, 2018

Conversation

bjorn3
Copy link
Collaborator

@bjorn3 bjorn3 commented Jun 8, 2018

screenshot_2018-06-08 example rs 2

TODO

  • Find a way to read discriminant of a Value
  • Test union handling
  • Handle generic adt's

@bjorn3 bjorn3 requested a review from oli-obk June 8, 2018 17:40
@bjorn3 bjorn3 mentioned this pull request Jun 8, 2018
8 tasks
@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from 4510f13 to 3d1b057 Compare June 8, 2018 19:02
@bjorn3
Copy link
Collaborator Author

bjorn3 commented Jun 10, 2018

Blocked on rust-lang/rust#51471

Ok(format!("{0}", bits))
}
TypeVariants::TyInt(_) => {
Ok(format!("{0}", bits as i128))
Copy link
Owner

Choose a reason for hiding this comment

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

this should not work for i64 and smaller. You need to sign extend first

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

};
pretty.push_str(&format!("{}: {}, ", adt_field.ident.as_str(), match field_pretty {
Ok(field_pretty) => field_pretty,
Err(_err) => "<span style='color: red;'>&lt;err&gt;</span>".to_string(),
Copy link
Owner

Choose a reason for hiding this comment

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

when does this case occur? if the memory is malformed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, or not yet initialized.

@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from c58b6d9 to 84dcc83 Compare June 10, 2018 16:51
@bjorn3 bjorn3 force-pushed the value_printing_refactor branch 2 times, most recently from 6ded07d to f2824ca Compare July 10, 2018 16:09
@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from 24df9f8 to ade59db Compare August 1, 2018 17:31
@bjorn3
Copy link
Collaborator Author

bjorn3 commented Aug 1, 2018

This works for enums now:

screenshot_2018-08-01 example rs

@oli-obk
Copy link
Owner

oli-obk commented Aug 2, 2018

Sweet, this makes reading the local table so much better. For larger structs we might want to wrap it in a <details> html tag and insert some newlines between the fields.

@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from 8d0cf9e to 4864e90 Compare August 4, 2018 09:15
@bjorn3
Copy link
Collaborator Author

bjorn3 commented Aug 4, 2018

For larger structs we might want to wrap it in a <details> html tag and insert some newlines between the fields.

Done

screenshot_2018-08-04 example rs

Build is failing due to broken miri.

@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from 4864e90 to f5de0e6 Compare August 4, 2018 09:33
@bjorn3 bjorn3 changed the title [WIP] Value printing refactor (pretty print structs) Value printing refactor (pretty print structs) Aug 6, 2018
@bjorn3 bjorn3 force-pushed the value_printing_refactor branch from 9127c24 to cf59695 Compare August 13, 2018 09:30
@bjorn3 bjorn3 merged commit 1de84cd into oli-obk:master Aug 13, 2018
@bjorn3 bjorn3 deleted the value_printing_refactor branch August 13, 2018 09:30
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.

2 participants