swc_core::base::atoms

Type Alias StaticString

pub type StaticString = Atom;
Available on crate feature __base only.
Expand description

This should be used as a key for hash maps and hash sets.

This will be replaced with Atom in the future.

Aliased Type§

struct StaticString(/* private fields */);

Implementations

§

impl Atom

pub fn new<S>(s: S) -> Atom
where Atom: From<S>,

Creates a new Atom from a string.

pub fn to_ascii_lowercase(&self) -> Atom

pub fn as_str(&self) -> &str

Trait Implementations

§

impl Archive for Atom

NOT A PUBLIC API

§

type Archived = ArchivedString

The archived representation of this type. Read more
§

type Resolver = StringResolver

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
§

fn resolve( &self, resolver: <Atom as Archive>::Resolver, out: Place<<Atom as Archive>::Archived>, )

Creates the archived version of this value at the given position and writes it to the given output. Read more
§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
§

impl AsRef<str> for Atom

§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<__C> CheckBytes<__C> for Atom
where __C: Fallible + ?Sized, <__C as Fallible>::Error: Trace, Atom: CheckBytes<__C>,

§

unsafe fn check_bytes( value: *const Atom, context: &mut __C, ) -> Result<(), <__C as Fallible>::Error>

Checks whether the given pointer points to a valid value within the given context. Read more
§

impl Clone for Atom

§

fn clone(&self) -> Atom

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Atom

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Atom

§

fn default() -> Atom

Returns the “default value” for a type. Read more
§

impl Deref for Atom

§

type Target = str

The resulting type after dereferencing.
§

fn deref(&self) -> &<Atom as Deref>::Target

Dereferences the value.
§

impl<'de> Deserialize<'de> for Atom

§

fn deserialize<D>( deserializer: D, ) -> Result<Atom, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Atom

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl EqIgnoreSpan for Atom

§

fn eq_ignore_span(&self, r: &Atom) -> bool

§

impl EsReserved for Atom

§

impl<V> FoldWith<V> for Atom
where V: Fold + ?Sized,

§

fn fold_with(self, visitor: &mut V) -> Atom

Calls Fold::fold_atom with self. (Extra impl)

§

fn fold_children_with(self, visitor: &mut V) -> Atom

Visit children nodes of self`` with visitor`.
§

impl<V> FoldWith<V> for Atom
where V: Fold + ?Sized,

§

fn fold_with(self, visitor: &mut V) -> Atom

Calls [Fold::fold_atom] with self. (Extra impl)

§

fn fold_children_with(self, visitor: &mut V) -> Atom

Visit children nodes of self`` with visitor`.
§

impl From<&str> for Atom

§

fn from(s: &str) -> Atom

Converts to this type from the input type.
§

impl From<Atom> for Atom

§

fn from(s: Atom) -> Atom

Converts to this type from the input type.
§

impl From<Box<str>> for Atom

§

fn from(s: Box<str>) -> Atom

Converts to this type from the input type.
§

impl From<Cow<'_, str>> for Atom

§

fn from(s: Cow<'_, str>) -> Atom

Converts to this type from the input type.
§

impl From<IdentLike> for Atom

§

fn from(i: IdentLike) -> Atom

Converts to this type from the input type.
§

impl From<KnownIdent> for Atom

§

fn from(s: KnownIdent) -> Atom

Converts to this type from the input type.
§

impl From<String> for Atom

§

fn from(s: String) -> Atom

Converts to this type from the input type.
§

impl From<Word> for Atom

§

fn from(w: Word) -> Atom

Converts to this type from the input type.
§

impl Hash for Atom

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl IdentLike for Atom

§

fn from_ident(i: &Ident) -> Atom

§

fn to_id(&self) -> (Atom, SyntaxContext)

§

fn into_id(self) -> (Atom, SyntaxContext)

§

impl Ord for Atom

§

fn cmp(&self, other: &Atom) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl PartialEq<&str> for Atom

§

fn eq(&self, other: &&str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Arc<str>> for Atom

§

fn eq(&self, other: &Arc<str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Box<str>> for Atom

§

fn eq(&self, other: &Box<str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Cow<'_, str>> for Atom

§

fn eq(&self, other: &Cow<'_, str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<Rc<str>> for Atom

§

fn eq(&self, other: &Rc<str>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<String> for Atom

§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<str> for Atom

§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for Atom

§

fn eq(&self, other: &Atom) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialOrd for Atom

§

fn partial_cmp(&self, other: &Atom) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<S> Serialize<S> for Atom
where S: Fallible + Writer + ?Sized, <S as Fallible>::Error: Source,

NOT A PUBLIC API

§

fn serialize( &self, serializer: &mut S, ) -> Result<<Atom as Archive>::Resolver, <S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
§

impl Serialize for Atom

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<V> VisitMutWith<V> for Atom
where V: VisitMut + ?Sized,

§

fn visit_mut_with(&mut self, visitor: &mut V)

Calls VisitMut::visit_mut_atom with self. (Extra impl)

§

fn visit_mut_children_with(&mut self, visitor: &mut V)

Visit children nodes of self`` with visitor`.
§

impl<V> VisitMutWith<V> for Atom
where V: VisitMut + ?Sized,

§

fn visit_mut_with(&mut self, visitor: &mut V)

Calls [VisitMut::visit_mut_atom] with self. (Extra impl)

§

fn visit_mut_children_with(&mut self, visitor: &mut V)

Visit children nodes of self`` with visitor`.
§

impl<V> VisitWith<V> for Atom
where V: Visit + ?Sized,

§

fn visit_with(&self, visitor: &mut V)

Calls Visit::visit_atom with self. (Extra impl)

§

fn visit_children_with(&self, visitor: &mut V)

Visit children nodes of self`` with visitor`.
§

impl<V> VisitWith<V> for Atom
where V: Visit + ?Sized,

§

fn visit_with(&self, visitor: &mut V)

Calls [Visit::visit_atom] with self. (Extra impl)

§

fn visit_children_with(&self, visitor: &mut V)

Visit children nodes of self`` with visitor`.
§

impl Eq for Atom

§

impl StructuralPartialEq for Atom