blob: 489cf8bb25985d47d578917bb26f9310f5e23531 [file] [log] [blame] [edit]
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
pub fn returns_some_int() -> Option<i32> {
Some(42)
}
pub fn returns_no_int() -> Option<i32> {
None
}
pub fn unwrap_or_zero(x: Option<i32>) -> i32 {
x.unwrap_or(0)
}
pub fn option_increments(x: Option<i32>) -> Option<i32> {
x.map(|x| x + 1)
}