Skip to content

Conversation

steveklabnik
Copy link
Contributor

Each formatting trait now has an example of implementation, as well as a
fuller description of what it's supposed to output.

It also contains a link to the module-level documentation which

Fixes #25765

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

///
/// // convert val to base 8 here in a real implementation
///
/// write!(f, "{}", val)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use {:o} to format val here? Same with the binary case, you'd just reuse {:b} on the inner value. Maybe it's a bit confusing but that's what a real world impl would do I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, so originally, I started out with a type that was just a unit struct, but then in an effort to make it more real, switched to Length.

@steveklabnik
Copy link
Contributor Author

Thanks @bluss, even better now :)

/// impl fmt::UpperExp for Length {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// let val = self.0;
/// write!(f, "{}.0E-11", val)
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry to ask again, but is this intended to be accurate? Then it should be {}.0E0.

@bluss
Copy link
Contributor

bluss commented Jul 6, 2015

r=me with the scientific notation confirmed and tidy errors fixed!

Nice new avatar!

Each formatting trait now has an example of implementation, as well as a
fuller description of what it's supposed to output.

It also contains a link to the module-level documentation which

Fixes rust-lang#25765
@steveklabnik
Copy link
Contributor Author

@bors: r=bluss rollup

@bors
Copy link
Collaborator

bors commented Jul 6, 2015

📌 Commit 3a6cd64 has been approved by bluss

@steveklabnik
Copy link
Contributor Author

Nice new avatar

Thanks :) been using it on Twitter for a while, realized I forgot to update it here...

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 6, 2015
Each formatting trait now has an example of implementation, as well as a
fuller description of what it's supposed to output.

It also contains a link to the module-level documentation which

Fixes rust-lang#25765
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 6, 2015
Each formatting trait now has an example of implementation, as well as a
fuller description of what it's supposed to output.

It also contains a link to the module-level documentation which

Fixes rust-lang#25765
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 7, 2015
Each formatting trait now has an example of implementation, as well as a
fuller description of what it's supposed to output.

It also contains a link to the module-level documentation which

Fixes rust-lang#25765
bors added a commit that referenced this pull request Jul 7, 2015
@bors bors merged commit 3a6cd64 into rust-lang:master Jul 7, 2015
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.

5 participants