bridge_types

Type Alias LooseString

Source
pub type LooseString<'a> = Cow<'a, str>;
Expand description

Type to hold anything in Slosh that can be represented as a String.

Public type used by rust native -> slosh bridge macro to represent arguments that can be loosely cast to strings. Unlike the String and &str types, in slosh there are various types that can be represented as strings. When the rust native function doesn’t require strict type checking on whether or not the Value::String type is passed in use this function.

Can represent SlRefInto Value types:

  • String
  • CodePoint
  • CharCluster
  • CharClusterLong
  • Symbol
  • Keyword
  • StringConst

Always does an allocation and returns a Value::String type.

Aliased Type§

enum LooseString<'a> {
    Borrowed(&'a str),
    Owned(String),
}

Variants§

§1.0.0

Borrowed(&'a str)

Borrowed data.

§1.0.0

Owned(String)

Owned data.