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

esp-hal: add doctest showing how to use Jiff #3232

Merged
merged 1 commit into from
Mar 7, 2025
Merged

Conversation

BurntSushi
Copy link
Contributor

This attempts to add a doctest showing how to plug a micro-second Unix
timestamp into Jiff, and then get, e.g., the weekday in a particular
locale. The example also makes use of Jiff's new tz::get! proc-macro
for embedding time zones into the binary for use in core-only
environments.

Ref #3185, Ref #3200

This attempts to add a doctest showing how to plug a micro-second Unix
timestamp into Jiff, and then get, e.g., the weekday in a particular
locale. The example also makes use of Jiff's new `tz::get!` proc-macro
for embedding time zones into the binary for use in core-only
environments.

Ref esp-rs#3185, Ref esp-rs#3200
@BurntSushi
Copy link
Contributor Author

BurntSushi commented Mar 6, 2025

I couldn't figure out how to make the test actually runnable, so it's tagged with no_run like the other doctests that I saw. I was using cargo xtask run-doc-tests esp-hal esp32c3 locally. Without no_run, the doctest just says something about using #[no_main] that I wasn't sure how to do.

@bugadani bugadani added the skip-changelog No changelog modification needed label Mar 6, 2025
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

Thanks! We can figure out the run / no_run later

@bjoernQ bjoernQ added this pull request to the merge queue Mar 7, 2025
/// let rtc = Rtc::new(peripherals.LPWR);
/// let now = Timestamp::from_microsecond(
/// rtc.current_time_us() as i64,
/// ).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we don't want unwraps in doctests anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

I will have a look after it's merged

Merged via the queue into esp-rs:main with commit b1d6023 Mar 7, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants