Type Alias deno_core::ModuleCode

source ·
pub type ModuleCode = FastString;

Aliased Type§

enum ModuleCode {
    Static(&'static str),
    StaticAscii(&'static str),
    Owned(Box<str, Global>),
    Arc(Arc<str, Global>),
}

Variants§

§

Static(&'static str)

Created from static data.

§

StaticAscii(&'static str)

Created from static data, known to contain only ASCII chars.

§

Owned(Box<str, Global>)

An owned chunk of data. Note that we use Box rather than Vec to avoid the storage overhead.

§

Arc(Arc<str, Global>)

Implementations§

source§

impl FastString

source

pub const fn from_static(s: &'static str) -> Self

Create a FastString from a static string. The string may contain non-ASCII characters, and if so, will take the slower path when used in v8.

source

pub const fn ensure_static_ascii(s: &'static str) -> Self

Create a FastString from a static string. If the string contains non-ASCII characters, the compiler will abort.

source

pub fn into_cheap_copy(self) -> (Self, Self)

Creates a cheap copy of this FastString, potentially transmuting it to a faster form. Note that this is not a clone operation as it consumes the old FastString.

source

pub fn try_clone(&self) -> Option<Self>

If this FastString is cheaply cloneable, returns a clone.

source

pub const fn try_static_ascii(&self) -> Option<&'static [u8]>

source

pub fn as_bytes(&self) -> &[u8]

source

pub fn as_str(&self) -> &str

source

pub fn v8<'a>(&self, scope: &mut HandleScope<'a>) -> Local<'a, String>

Create a v8 string from this FastString. If the string is static and contains only ASCII characters, an external one-byte static is created.

source

pub fn truncate(&mut self, index: usize)

Truncates a FastString value, possibly re-allocating or memcpy’ing. May be slow.

Trait Implementations§

source§

impl AsRef<str> for FastString

source§

fn as_ref(&self) -> &str

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

impl Borrow<str> for FastString

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl Debug for FastString

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for FastString

source§

fn default() -> Self

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

impl From<Arc<str, Global>> for FastString

FastString can be made cheaply from Arc<str> as we know it’s shared and don’t need to do an ASCII check.

source§

fn from(value: Arc<str>) -> Self

Converts to this type from the input type.
source§

impl From<String> for FastString

FastString can be made cheaply from String as we know it’s owned and don’t need to do an ASCII check.

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Url> for FastString

FastString can be made cheaply from Url as we know it’s owned and don’t need to do an ASCII check.

source§

fn from(value: Url) -> Self

Converts to this type from the input type.
source§

impl Hash for FastString

source§

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

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
source§

impl PartialEq<FastString> for FastString

source§

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

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

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

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

impl Eq for FastString