We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 890d1bb commit ce7a285Copy full SHA for ce7a285
starlark/src/values/value_of.rs
@@ -25,6 +25,7 @@ use crate::values::AllocValue;
25
use crate::values::Heap;
26
use crate::values::UnpackValue;
27
use crate::values::Value;
28
+use crate::values::ValueOfUnchecked;
29
30
/// A wrapper that keeps the original value on the heap for use elsewhere,
31
/// and also, when unpacked, unpacks the value to validate it is of
@@ -39,6 +40,13 @@ pub struct ValueOf<'v, T: UnpackValue<'v>> {
39
40
pub typed: T,
41
}
42
43
+impl<'v, T: UnpackValue<'v>> ValueOf<'v, T> {
44
+ /// Convert to `ValueOfUnchecked`.
45
+ pub fn as_unchecked(&self) -> ValueOfUnchecked<'v, T> {
46
+ ValueOfUnchecked::new(self.value)
47
+ }
48
+}
49
+
50
impl<'v, T: UnpackValue<'v>> Deref for ValueOf<'v, T> {
51
type Target = Value<'v>;
52
0 commit comments