We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c3bb1f commit 1b790a8Copy full SHA for 1b790a8
starlark/src/values/types/none/none_or.rs
@@ -51,6 +51,15 @@ impl<T> NoneOr<T> {
51
}
52
53
54
+ /// Convert a Rust [`Option`] to a [`NoneOr`].
55
+ #[inline]
56
+ pub fn from_option(option: Option<T>) -> Self {
57
+ match option {
58
+ None => NoneOr::None,
59
+ Some(x) => NoneOr::Other(x),
60
+ }
61
62
+
63
/// Is the value a [`NoneOr::None`].
64
pub fn is_none(&self) -> bool {
65
matches!(self, NoneOr::None)
0 commit comments