1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
use super::{BasicType, BasicTypeBase, TypeKind}; mod functions; mod ops; pub type StringType = BasicType<StringImpl>; pub const fn name() -> &'static str { "std::string::String" } pub struct StringImpl; impl StringType { pub fn new() -> Self { Self::default() } } impl Default for StringType { fn default() -> Self { BasicType::from_base_with_functions( StringImpl, vec![ (crate::ops::ADD, ops::add), (crate::ops::EQUAL, ops::equal), (crate::ops::NOT_EQUAL, ops::not_equal), (crate::ops::LESS, ops::less), (crate::ops::LESS_OR_EQUAL, ops::less_or_equal), (crate::ops::GREATER, ops::greater), (crate::ops::GREATER_OR_EQUAL, ops::greater_or_equal), ("clone", functions::clone), ("eq_ignore_ascii_case", functions::eq_ignore_ascii_case), ("is_ascii", functions::is_ascii), ("is_char_boundary", functions::is_char_boundary), ("is_empty", functions::is_empty), ("len", functions::len), ("repeat", functions::repeat), ("to_ascii_lowercase", functions::to_ascii_lowercase), ("to_ascii_uppercase", functions::to_ascii_uppercase), ("to_lowercase", functions::to_lowercase), ("to_string", functions::to_string), ("to_uppercase", functions::to_uppercase), ("trim", functions::trim), ("trim_end", functions::trim_end), ("trim_start", functions::trim_start), ], ) } } impl BasicTypeBase for StringImpl { fn name(&self) -> &str { self::name() } fn kind(&self) -> TypeKind { TypeKind::String } }