blob: 28f170e51cf194cf0d63e88d26775d171c7a582b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#[lang = "sized"]
pub trait Sized {}
pub enum Option<T> {
Some(T),
None,
}
pub use Option::{None, Some};
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
impl<T> Option<T> {
pub fn map<R, F: FnOnce(T) -> R>(self, f: F) -> Option<R> {
match self {
Some(value) => Some(f(value)),
None => None,
}
}
}
|