Skip to content

Commit 6e130fc

Browse files
JakobDegenfacebook-github-bot
authored andcommitted
Add unpack_str_err
Summary: To be used next diff Reviewed By: IanChilds Differential Revision: D72296175 fbshipit-source-id: d825bd8b88c77f0bc0e5f0892f607f5d1e389d4b
1 parent 776a920 commit 6e130fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

starlark/src/values/layout/value.rs

+6
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ impl<'v> Value<'v> {
466466
self.unpack_starlark_str().map(|s| s.as_str())
467467
}
468468

469+
/// Obtain the underlying `str` if it is a string, otherwise return an error for users.
470+
#[inline]
471+
pub fn unpack_str_err(self) -> crate::Result<&'v str> {
472+
UnpackValue::unpack_value_err(self)
473+
}
474+
469475
/// Get a pointer to a [`AValue`].
470476
#[inline]
471477
pub(crate) fn get_ref(self) -> AValueDyn<'v> {

0 commit comments

Comments
 (0)