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

Remove DisplayMode #119

Merged

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented May 27, 2020

  • Check that you've added documentation to any new methods
  • Rebase from master if you're not already up to date
  • Add or modify an example if there are changes to the public API
  • Add a CHANGELOG.md entry in the Unreleased section under the appropriate heading (Added, Fixed, Changed, etc)
  • Run rustfmt on the project with cargo fmt --all - CI will not pass without this step
  • Check that your branch is up to date with master and that CI is passing once the PR is opened

PR description

This PR removes the DisplayMode struct. As far as I can tell, DisplayMode is only used currently as the return value of Builder::connect() and it is immediately transformed into a specific DisplayModeTrait implementation.

This PR also removes the now obsolete RawMode which was closely connected to the above mechanism.

This is only a proposal and I fully expect it to be rejected. Also, the Into trait is not implemented for the display modes, as for some reason I get trait impl conflicts when I attempt to do so.

Copy link
Collaborator

@jamwaffles jamwaffles left a comment

Choose a reason for hiding this comment

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

This actually looks pretty good to me so far, so thanks for taking the time to clean this crate up a bit!

After running cargo fmt and TARGET=thumbv7m-none-eabi ./build.sh, I see the noise_i2c.rs fails to compile. The call to disp.release() should be replaced with disp.properties() (which incidentally is what I should've used in the first place!)

There's also a now-broken doc link as RawMode is removed. I haven't checked the docs yet but there are likely some paragraphs that can be removed now.

@jamwaffles
Copy link
Collaborator

If this is a superset of #118, please close #118 so we don't get duplicate PRs.

@bugadani
Copy link
Contributor Author

Not so much a superset, but I branched off of that PR in case this one is rejected or that one is accidentally merged :) It's not about duplicate functionality, but incremental changes.

I have one more addition to make: brightness adjustment. Should I include it in this PR as well?

@jamwaffles
Copy link
Collaborator

Not so much a superset, but I branched off of that PR

Ok, understood! I notice both commits from the other PR are included in this one though, so it might be a good idea to rebase this PR from master to keep all these PRs more tightly scoped.

I have one more addition to make: brightness adjustment.

More additions always welcome! I would prefer this to be in a separate PR if you don't mind. For one thing, it helps keep the changelog organised :)

@bugadani
Copy link
Contributor Author

so it might be a good idea to rebase this PR from master to keep all these PRs more tightly scoped.

Unfortunately, rebasing this to master would cause some conflict so it would be more work than merging #118 and then continuing work on this one. I'll tidy that one up first.

@jamwaffles
Copy link
Collaborator

Ok, no worries :)

@therealprof
Copy link
Collaborator

Unfortunately, rebasing this to master would cause some conflict so it would be more work than merging #118 and then continuing work on this one. I'll tidy that one up first.

That is superweird and unexpected. But it's a good idea to keep seperate things separate anyway.

@bugadani bugadani force-pushed the feature/remove-displaymode branch 2 times, most recently from f9615ec to bc1ff12 Compare May 27, 2020 17:02
@bugadani bugadani force-pushed the feature/remove-displaymode branch from bc1ff12 to 3a788cc Compare June 6, 2020 14:51
@bugadani
Copy link
Contributor Author

bugadani commented Jun 6, 2020

I've spent some time cleaning up the links. Unfortunately, it looks like the link checker doesn't know about inter-crate link format and fails, however I believe it is the preferred linking format since cargo doc automatically checks them when generating the docs.

Also, no longer based on #118

@bugadani bugadani marked this pull request as ready for review June 6, 2020 17:16
Copy link
Collaborator

@jamwaffles jamwaffles left a comment

Choose a reason for hiding this comment

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

Looking good so far, just some small things I picked up.

Unfortunately, it looks like the link checker doesn't know about inter-crate link format and fails

That's correct. The linkchecker in the build script was only ever designed for http:// links.

I really like the intra doc link feature and would much prefer to use it, but as it's currently still nightly I'd prefer to keep the relative path links for now.

src/lib.rs Outdated
Comment on lines 5 to 6
//! returns a [`DisplayProperties`] instance which is a low level interface to manipulate the display properties (e.g. rotation).
//! You can coerce the driver into a more useful mode by calling `into()` and defining the type you want to coerce to. For
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please wrap this to 100 columns.

While we're here, I'd also suggest rewording the You can coerce the driver part to The driver can be coerced.

src/builder.rs Outdated
Comment on lines 52 to 56
//!
//! [`I2CDIBuilder`]: crate::builder::I2CDIBuilder
//! [`DisplayProperties`]: crate::properties::DisplayProperties
//! [`GraphicsMode`]: crate::mode::graphics::GraphicsMode
//! [`TerminalMode`]: crate::mode::terminal::TerminalMode
Copy link
Collaborator

Choose a reason for hiding this comment

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

Much cleaner, thanks. As mentioned in the review comments, please change these links (and all others in the PR) back to relative paths. Linkchecker and manual docs surfing should help here.

@bugadani
Copy link
Contributor Author

bugadani commented Jun 7, 2020

I'll make the changes once I'm at a computer, but are the intra-crate links really nightly? I'll also double check that but I think they are stable, at least docs.rs knows about them IIRC.

@jamwaffles
Copy link
Collaborator

Unfortunately yes, at least until rust-lang/rust#43466 is closed I guess. As for docs.rs, https://docs.rs/about states that:

Docs.rs automatically builds crates' documentation released on crates.io using the nightly release of the Rust compiler.

Which is why they work there.

@therealprof
Copy link
Collaborator

Nice cleanup. Would be great to land this.

@therealprof therealprof mentioned this pull request Jun 7, 2020
6 tasks
therealprof
therealprof previously approved these changes Jun 7, 2020
Copy link
Collaborator

@therealprof therealprof left a comment

Choose a reason for hiding this comment

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

Excellent.

Copy link
Collaborator

@jamwaffles jamwaffles left a comment

Choose a reason for hiding this comment

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

👌

Copy link
Collaborator

@jamwaffles jamwaffles left a comment

Choose a reason for hiding this comment

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

Argh, one last thing I didn't catch before in the changelog. I doubt many people were using RawMode but its removal is technically a breaking change.

The name is also incorrect which might be confusing to anybody migrating code using the changelog.

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: James Waples <[email protected]>
@bugadani
Copy link
Contributor Author

bugadani commented Jun 8, 2020

I hope you don't mind if I took the lazy way of pressing the Commit suggestion button 😅

@jamwaffles jamwaffles merged commit 83c6cf6 into rust-embedded-community:master Jun 8, 2020
@jamwaffles
Copy link
Collaborator

No problem - I squash merged this PR anyway :). Thanks for the changes!

@bugadani bugadani deleted the feature/remove-displaymode branch June 8, 2020 08:29
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