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

Allow implementation of Show for RadixFmt with user-defined type #18301

Closed
jsanders opened this issue Oct 25, 2014 · 1 comment
Closed

Allow implementation of Show for RadixFmt with user-defined type #18301

jsanders opened this issue Oct 25, 2014 · 1 comment

Comments

@jsanders
Copy link
Contributor

I'm not sure whether or not this is meant to work already. It is almost possible with:

impl fmt::Show for fmt::RadixFmt<MyType, fmt::Radix> {
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        let fmt::RadixFmt(ref x, radix) = *self;
        let base = radix.base; // This doesn't work because base is private
        // ...
    }
}

It doesn't seem possible to get the actual base out, due to its privacy. It used to be possible to provide a ToStrRadix implementation for a user-defined type, and it would be really nice to be able to use the fmt::radix method.

@huonw huonw added the A-libs label Oct 25, 2014
jsanders added a commit to jsanders/rust-gmp that referenced this issue Oct 25, 2014
Sadly there doesn't seem to be a replacement for ToStrRadix on user
types at the moment. See: rust-lang/rust#18301
@steveklabnik
Copy link
Member

I'm going to give this a close, as it's been a long time, and #27728 is the tracking issue for such functionality now.

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

No branches or pull requests

3 participants