[−][src]Struct iso15924::code::ScriptCode
Representation of each script code with all of the information provided by the standard.
Serde
This struct derives serde's Deserialize
and Serialize
if you enable the
serde
feature.
Fields
alias: Option<Cow<'a, str>>
The Property Value Alias
as defined by unicode.org.
The definition is located here:
http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt
code: Cow<'a, str>
4-character representation of the script code.
date: ScriptDate
The date of the introduction of the script to the standard.
name: Cow<'a, str>
The English name of the script code.
name_french: Cow<'a, str>
The French name of the script code.
num: Cow<'a, str>
Numeric 3-digit representation of the script code.
unicode_version: Option<(u8, u8)>
The version of the Unicode specification that the script was added in.
Methods
impl<'_> ScriptCode<'_>
[src]
pub fn all() -> &'static [ScriptCode<'static>]
[src]
Returns all of the script codes in no guarenteed order.
pub fn by_alias(alias: impl AsRef<str>) -> Option<&'static ScriptCode<'static>>
[src]
Retrieve a ScriptCode
via its alias
(Property Value Alias
) value if
one exists.
Examples
use iso15924::ScriptCode; assert!(ScriptCode::by_alias("Ahom").is_some());
pub fn by_code(code: impl AsRef<str>) -> Option<&'static ScriptCode<'static>>
[src]
Retrieve a ScriptCode
via its code
value if one exists.
Examples
use iso15924::ScriptCode; assert!(ScriptCode::by_code("Blis").is_some()); assert!(ScriptCode::by_code("Abza").is_none());
pub fn by_date_range(
from: Option<ScriptDate>,
to: Option<ScriptDate>
) -> Vec<&'static ScriptCode<'static>>
[src]
from: Option<ScriptDate>,
to: Option<ScriptDate>
) -> Vec<&'static ScriptCode<'static>>
Retrieve a Vec
of ScriptCode
s with ScriptDate
s that are within the
range of the from
and to
given. The from
and to
are both optional,
and can either be None
or Some(ScriptDate)
for variations of the range
wanted.
Examples
Getting all ScriptCode
s between 2005-01-01
and 2012-01-01
:
use iso15924::{ScriptCode, ScriptDate}; let date_from = ScriptDate::new(2005, 01, 01); let date_to = ScriptDate::new(2012, 01, 01); let scripts = ScriptCode::by_date_range(Some(date_from), Some(date_to));
Retrieving all ScriptCode
s after 2005-01-01
:
use iso15924::{ScriptCode, ScriptDate}; let date_from = ScriptDate::new(2005, 01, 01); let scripts = ScriptCode::by_date_range(Some(date_from), None);
Retrieving all ScriptCode
s before 2012-01-01
:
use iso15924::{ScriptCode, ScriptDate}; let date_to = ScriptDate::new(2012, 01, 01); let scripts = ScriptCode::by_date_range(None, Some(date_to));
Consequentially, you can also retrieve no values:
use iso15924::ScriptCode; assert_eq!(0, ScriptCode::by_date_range(None, None).len());
pub fn by_name(name: impl AsRef<str>) -> Option<&'static ScriptCode<'static>>
[src]
Retrieve a ScriptCode
via its name
if it exists:
use iso15924::ScriptCode; let script1 = ScriptCode::by_name("Adlam"); assert!(script1.is_some()); let script2 = ScriptCode::by_name("Aaaaa"); assert!(script2.is_none());
pub fn by_name_french(
name: impl AsRef<str>
) -> Option<&'static ScriptCode<'static>>
[src]
name: impl AsRef<str>
) -> Option<&'static ScriptCode<'static>>
Retrieve a ScriptCode
via its name_french
if it exists:
use iso15924::ScriptCode; assert!(ScriptCode::by_name_french("arabe").is_some()); assert!(ScriptCode::by_name_french("aaaaa").is_none());
pub fn by_num(num: impl AsRef<str>) -> Option<&'static ScriptCode<'static>>
[src]
Retrieve a ScriptCode
via its num
if it exists:
use iso15924::ScriptCode; assert!(ScriptCode::by_num("070").is_some()); assert!(ScriptCode::by_num("000").is_none());
Trait Implementations
impl<'a> Clone for ScriptCode<'a>
[src]
fn clone(&self) -> ScriptCode<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Eq for ScriptCode<'a>
[src]
impl<'a> Ord for ScriptCode<'a>
[src]
fn cmp(&self, other: &ScriptCode<'a>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'a> PartialEq<ScriptCode<'a>> for ScriptCode<'a>
[src]
fn eq(&self, other: &ScriptCode<'a>) -> bool
[src]
fn ne(&self, other: &ScriptCode<'a>) -> bool
[src]
impl<'a> PartialOrd<ScriptCode<'a>> for ScriptCode<'a>
[src]
fn partial_cmp(&self, other: &ScriptCode<'a>) -> Option<Ordering>
[src]
fn lt(&self, other: &ScriptCode<'a>) -> bool
[src]
fn le(&self, other: &ScriptCode<'a>) -> bool
[src]
fn gt(&self, other: &ScriptCode<'a>) -> bool
[src]
fn ge(&self, other: &ScriptCode<'a>) -> bool
[src]
impl<'a> Debug for ScriptCode<'a>
[src]
impl<'a> Hash for ScriptCode<'a>
[src]
Auto Trait Implementations
impl<'a> Send for ScriptCode<'a>
impl<'a> Sync for ScriptCode<'a>
impl<'a> Unpin for ScriptCode<'a>
impl<'a> UnwindSafe for ScriptCode<'a>
impl<'a> RefUnwindSafe for ScriptCode<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,