Type Alias starlark::values::StringValue

source ·
pub type StringValue<'v> = ValueTyped<'v, StarlarkStr>;
Expand description

Convenient type alias.

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

Aliased Type§

struct StringValue<'v>(/* private fields */);

Implementations§

source§

impl<'v> StringValue<'v>

source

pub fn freeze(self, freezer: &Freezer) -> Result<FrozenStringValue>

Convert a value to a FrozenStringValue using a supplied Freezer.

source

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

Get self along with the hash.

source

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

Get the string reference along with the hash.

source

pub fn get_hashed_value(self) -> Hashed<Value<'v>>

Get the Value along with the hash.

source

pub fn unpack_frozen(self) -> Option<FrozenStringValue>

If this string value is frozen, return it.

Trait Implementations§

source§

impl<'v> Borrow<str> for StringValue<'v>

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl<'v> Default for StringValue<'v>

source§

fn default() -> Self

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

impl<'v> Equivalent<FrozenValueTyped<'static, StarlarkStr>> for StringValue<'v>

source§

fn equivalent(&self, key: &FrozenStringValue) -> bool

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

impl<'v> Freeze for StringValue<'v>

§

type Frozen = FrozenValueTyped<'static, StarlarkStr>

When type is frozen, it is frozen into this type.
source§

fn freeze(self, freezer: &Freezer) -> Result<FrozenStringValue>

Freeze a value. The frozen value must be equal to the original, and produce the same hash. Read more
source§

impl<'v> Hash for StringValue<'v>

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<'v> Ord for StringValue<'v>

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<FrozenValueTyped<'static, StarlarkStr>> for StringValue<'v>

source§

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

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 StringValue<'v>

source§

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

Convert to a StringValue.
source§

fn as_str(self) -> &'v str

Convert to a str.