Skip to content

Tracking Issue for {char, u8}::is_ascii_octdigit #101288

Open

Description

@oppiliappan

Feature gate: #![feature(is_ascii_octdigit)]

This is a tracking issue for two new methods char::is_ascii_octdigit and u8::is_ascii_octdigit, which, in the same vein as is_ascii_hexdigit, checks if a value is an ASCII octal digit ('0'..='7').

This is a shorthand for {char, u8}::is_digit(self, 8). Prior discussion on irlo.

Public API

// core::char

impl char {
    pub fn is_ascii_octdigit(self) -> bool;
}

// core::num

impl u8 {
    pub fn is_ascii_octdigit(self) -> bool;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    T-libs-api[DEPRECATED; DO NOT USE]
    on Sep 1, 2022
  2. oppiliappan commented on Sep 1, 2022

    @oppiliappan
    ContributorAuthor

    @rustbot claim

  3. oppiliappan commented on Sep 2, 2022

    @oppiliappan
    ContributorAuthor

    This method is also applicable to bytes, so the scope of this issue extends to u8 as well.

  4. changed the title [-]Tracking Issue for `char::is_ascii_octdigit`[/-] [+]Tracking Issue for `{char, u8}::is_ascii_octdigit`[/+] on Sep 2, 2022
  5. DaniPopes commented on Sep 28, 2023

    @DaniPopes
    Contributor

    This has been unstable for more than a year, and since there are no reported issues or blockers I think this can be stabilized.

    The full API is this (note the &self and const):

    impl {char,u8} {
        pub const fn is_ascii_octdigit(&self) -> bool;
    }
  6. joshtriplett commented on Oct 5, 2023

    @joshtriplett
    Member

    Shall we stabilize is_ascii_octdigit?

    @rfcbot merge

  7. rfcbot commented on Oct 5, 2023

    @rfcbot

    Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

    Concerns:

    Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

    See this document for info about what commands tagged team members can give me.

  8. added
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    on Oct 5, 2023
  9. workingjubilee commented on Oct 10, 2023

    @workingjubilee
    Member

    Every function we add comes at the cost of making it harder to find others, and u8 already has a very heavily-loaded API. I am concerned this doesn't pull its weight. Many new Rust programmers often flail for some time while looking for basic functions. In the past week I've had to coach people on locating basic things like str::find.

  10. BurntSushi commented on Oct 10, 2023

    @BurntSushi
    Member

    @rfcbot concern does not pull its weight

    I'll file this concern because I'm not totally sold on this method either, but I lean towards including it. It fits right in with existing methods. With that said, octal notation is in my experience way less frequently used than either decimal or hexadecimal, so I'm not sold that it's worth adding a method specifically for it.

    We have at least a few examples where we load up types with lots of different methods, so I tend to think we should try to approach that problem in other ways. For example, improving rustdoc output. I am a casual user of separating methods into different groups based on categories that I think might be useful to others. Of course, one of the issues with this approach is that grouping is also somewhat determined by trait bounds, so this could overall be somewhat confusing given the status quo of rustdoc.

  11. m-ou-se commented on Nov 7, 2023

    @m-ou-se
    Member

    I'm also not convinced this method is worth adding. (Would we also add is_ascii_bindigit() too?)

    On char, this funcitonality is already available as .is_digit(8) (and .to_digit(8).is_some()).

  12. dtolnay commented on Jan 1, 2024

    @dtolnay
    Member

    +1 to the feeling that is_ascii_octdigit does not pull its weight as a dedicated API on u8 and char.

    For char this is served plenty well enough by .is_digit(8) as Mara wrote.

    What's the counterproposal for u8? Is it this?—

    let byte = b'7';
    println!("{}", (byte as char).is_digit(8));
  13. dtolnay commented on Jan 16, 2024

    @dtolnay
    Member

    From the last couple comments, I get the sense this is not going to go through.

    @rfcbot fcp cancel

  14. rfcbot commented on Jan 16, 2024

    @rfcbot

    @dtolnay proposal cancelled.

  15. removed
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    on Jan 16, 2024
  16. added
    T-libsRelevant to the library team, which will review and decide on the PR/issue.
    and removed
    T-libs-api[DEPRECATED; DO NOT USE]
    on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions