Merge branch 'trunk' into builtin-count-graphemes

This commit is contained in:
Jared Ramirez 2020-11-07 18:49:29 -06:00 committed by GitHub
commit 74b09605a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1640 additions and 251 deletions

View file

@ -23,6 +23,10 @@ pub struct Lowercase(InlinableString);
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Uppercase(InlinableString);
/// A string representing a foreign (linked-in) symbol
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
pub struct ForeignSymbol(InlinableString);
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum TagName {
/// Global tags have no module, but tend to be short strings (since they're
@ -125,6 +129,28 @@ impl<'a> Into<Box<str>> for ModuleName {
}
}
impl ForeignSymbol {
pub fn as_str(&self) -> &str {
&*self.0
}
pub fn as_inline_str(&self) -> &InlinableString {
&self.0
}
}
impl<'a> From<&'a str> for ForeignSymbol {
fn from(string: &'a str) -> Self {
Self(string.into())
}
}
impl<'a> From<String> for ForeignSymbol {
fn from(string: String) -> Self {
Self(string.into())
}
}
impl Uppercase {
pub fn as_str(&self) -> &str {
&*self.0