Skip to content

Commit 6c984e4

Browse files
authored
Implement View and DeepView for Option<T> (#1389)
1 parent 768da6e commit 6c984e4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

source/vstd/std_specs/option.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ use core::option::Option::Some;
77

88
verus! {
99

10+
impl<T> View for Option<T> {
11+
type V = Option<T>;
12+
13+
open spec fn view(&self) -> Option<T> {
14+
*self
15+
}
16+
}
17+
18+
impl<T: DeepView> DeepView for Option<T> {
19+
type V = Option<T::V>;
20+
21+
open spec fn deep_view(&self) -> Option<T::V> {
22+
match self {
23+
Some(t) => Some(t.deep_view()),
24+
None => None,
25+
}
26+
}
27+
}
28+
1029
////// Add is_variant-style spec functions
1130
pub trait OptionAdditionalFns<T>: Sized {
1231
#[allow(non_snake_case)]

0 commit comments

Comments
 (0)