use unicode_ident::{
is_xid_continue,
is_xid_start
};
pub trait Character where
Self: Sized
{
fn is_ascii_decimal(&self) -> bool;
fn is_newline(&self) -> bool;
fn is_whitespace(&self) -> bool;
fn length(&self) -> usize;
fn is_unicode_identifier_start(&self) -> bool;
fn is_unicode_identifier_continuation(&self) -> bool;
fn write(&self, buffer: &mut String);
}
impl Character for char {
fn is_ascii_decimal(&self) -> bool { self.is_ascii_digit() }
fn is_newline(&self) -> bool {
char::is_whitespace(*self)
}
fn is_whitespace(&self) -> bool { char::is_whitespace(*self) }
fn length(&self) -> usize { self.len_utf8() }
fn is_unicode_identifier_start(&self) -> bool { is_xid_start(*self) }
fn is_unicode_identifier_continuation(&self) -> bool { is_xid_continue(*self) }
fn write(&self, buffer: &mut String) { buffer.push(*self) }
}