-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
implement Format
for core::time::Duration
#348
Comments
Same with all |
External crates need to implement |
This would be easier to implement if we could pad a value with zeroes ( |
I was just wondering if it is possible to apply own macros to foreign types, similar to how it is possible to impl own traits on foreign types? |
Also it doesn't seem to be possible to implement it like following for // src/impls.rs
impl Format for core::time::Duration {
fn format(&self, fmt: Formatter) {
crate::write!(
fmt,
"Duration {{ {=u64} {=u32} }}",
self.as_secs(),
self.subsec_nanos(),
)
}
}
// Error: failed to resolve: could not find `defmt` in `{{root}}` |
This is likely because the macros expect the invoking crate to depend on |
@jonas-schievink I've tried that, but still doesn't work. I've also tried to replace May you have a look here? https://github.com/knurling-rs/defmt/blob/348-format-for-duration/src/impls.rs#L462-L471 |
Okay, I fixed it for my case, but I am unsure if this breaks other stuff. Let's see in the reviews 😺 |
it would be nice if this type was supported
The text was updated successfully, but these errors were encountered: