1
struct Parser;

impl Parser {
    const ALPHABETS_UPPERCASE: [char; 26] = [
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  ];

  fn get_alphabet(&self) {
    self::..
  }
}

How to access ALPHABETS_UPPERCASE inside get_alphabet function?

1 Answer 1

3

Self::ALPHABET_UPPERCASE (and not self) since this constant takes place in Parser as a whole and not a peculiar instance.

See here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.