pub type FrozenStringValue = FrozenValueTyped<'static, StarlarkStr>;
Expand description

Convenient type alias.

We use FrozenValueTyped<StarlarkStr> often, but also we define more operations on FrozenValueTyped<StarlarkStr> than on generic FrozenValueTyped<T>.

Note there’s a macro const_frozen_string! to statically allocate FrozenStringValue:

use starlark::const_frozen_string;
use starlark::values::FrozenStringValue;
use starlark::values::FrozenValue;

let fv: FrozenStringValue = const_frozen_string!("magic");
assert_eq!("magic", fv.as_str());

Aliased Type§

struct FrozenStringValue(/* private fields */);

Implementations§

source§

impl FrozenStringValue

source

pub fn get_hashed(self) -> Hashed<Self>

Get self along with the hash.

source

pub fn get_hashed_value(self) -> Hashed<FrozenValue>

Get the FrozenValue along with the hash.

source

pub fn get_hashed_str(self) -> Hashed<&'static str>

Get the string reference along with the hash.

Trait Implementations§

source§

impl Borrow<str> for FrozenStringValue

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl Default for FrozenStringValue

source§

fn default() -> Self

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

impl<'v> Equivalent<ValueTyped<'v, StarlarkStr>> for FrozenStringValue

source§

fn equivalent(&self, key: &StringValue<'v>) -> bool

Compare self to key and return true if they are equal.
source§

impl Hash for FrozenStringValue

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 Ord for FrozenStringValue

source§

fn cmp(&self, other: &Self) -> 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 + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<'v> PartialEq<ValueTyped<'v, StarlarkStr>> for FrozenStringValue

source§

fn eq(&self, other: &StringValue<'v>) -> 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 PartialOrd for FrozenStringValue

source§

fn partial_cmp(&self, other: &Self) -> 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

This method 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

This method 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

This method 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

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

impl<'v> StringValueLike<'v> for FrozenStringValue

source§

fn to_string_value(self) -> StringValue<'v>

Convert to a StringValue.
source§

fn as_str(self) -> &'v str

Convert to a str.
source§

impl<'v> Coerce<ValueTyped<'v, StarlarkStr>> for FrozenStringValue

source§

impl<'v> CoerceKey<ValueTyped<'v, StarlarkStr>> for FrozenStringValue