arabic_script/core/unicode_character.rs
1/**************************************************************************************************
2 * Copyright 2023 Tamer Elzein <tamer@tamerudition.com> *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file *
5 * except in compliance with the License. You may obtain a copy of the License at *
6 * *
7 * http://www.apache.org/licenses/LICENSE-2.0 *
8 * *
9 * Unless required by applicable law or agreed to in writing, software distributed under the *
10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, *
11 * either express or implied. See the License for the specific language governing permissions *
12 * and limitations under the License. *
13 **************************************************************************************************/
14
15/// This trait ensures that a character exposes its Unicode owning block, name, and scalar value.
16pub trait UnicodeCharacter {
17 /// Returns the Unicode block of the character.
18 fn block(&self) -> &'static str;
19
20 /// Returns the Unicode name of the character.
21 fn name(&self) -> &'static str;
22
23 /// Returns the Unicode scalar value of the character, which is equivalent to a Rust [`char`].
24 fn scalar_value(&self) -> char;
25}