Skip to content

Commit 3247ed4

Browse files
stepanchegfacebook-github-bot
authored andcommitted
Rename ConstStringValue -> FrozenStringValue
Summary: There's `ConstFrozenStringN` type, which is `*FrozenValue` i. e. data, while `ConstFrozenString` is actually a `FrozenValue`, i. e. pointer. `FrozenStringValue` name is more consistent. Also, the type has nothing to do with type being "const" (which means here statically allocated), it can store frozen heap allocated value. Additionally, following diff D30884361 adds `StringValue` type. So the relation is: * `FrozenStringValue` is a wrapper for `FrozenValue` * `StringValue` is a wrapper for `Value` Reviewed By: ndmitchell Differential Revision: D30884360 fbshipit-source-id: 55493f25808ee47a090f52e3ab5062956f5d2c4a
1 parent 19d2b51 commit 3247ed4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

starlark/src/values/layout/constant.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ impl<const N: usize> ConstFrozenStringN<N> {
5353
}
5454

5555
/// Erase the type parameter, giving a slightly nicer user experience.
56-
pub const fn erase(&'static self) -> ConstFrozenString {
57-
ConstFrozenString(&self.repr)
56+
pub const fn erase(&'static self) -> FrozenStringValue {
57+
FrozenStringValue(&self.repr)
5858
}
5959
}
6060

@@ -64,23 +64,23 @@ impl<const N: usize> ConstFrozenStringN<N> {
6464
///
6565
/// ```
6666
/// use starlark::const_frozen_string;
67-
/// use starlark::values::{ConstFrozenString, FrozenValue};
67+
/// use starlark::values::{FrozenStringValue, FrozenValue};
6868
///
69-
/// static RES: ConstFrozenString = const_frozen_string!("magic");
69+
/// static RES: FrozenStringValue = const_frozen_string!("magic");
7070
/// let fv: FrozenValue = RES.unpack();
7171
/// assert_eq!(Some("magic"), fv.to_value().unpack_str());
7272
/// ```
7373
#[derive(Copy, Clone, Dupe)]
74-
pub struct ConstFrozenString(&'static AValueRepr<StarlarkStr>);
74+
pub struct FrozenStringValue(&'static AValueRepr<StarlarkStr>);
7575

76-
impl ConstFrozenString {
77-
/// Obtain the [`FrozenValue`] for a [`ConstFrozenString`].
76+
impl FrozenStringValue {
77+
/// Obtain the [`FrozenValue`] for a [`FrozenStringValue`].
7878
pub fn unpack(self) -> FrozenValue {
7979
FrozenValue::new_repr(self.0)
8080
}
8181
}
8282

83-
/// Create a [`ConstFrozenString`].
83+
/// Create a [`FrozenStringValue`].
8484
#[macro_export]
8585
macro_rules! const_frozen_string {
8686
($s:expr) => {{

starlark/src/values/layout/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod pointer_i32;
2727
mod value;
2828
mod value_captured;
2929

30-
pub use constant::{ConstFrozenString, ConstFrozenStringN};
30+
pub use constant::{ConstFrozenStringN, FrozenStringValue};
3131
pub use heap::{Freezer, FrozenHeap, FrozenHeapRef, Heap, Tracer};
3232
pub(crate) use pointer_i32::PointerI32;
3333
pub use value::{FrozenValue, Value};

0 commit comments

Comments
 (0)