在下面的代码中,我怎样才能返回
floor
的引用而不是一个新对象?是否可能使函数返回借用引用或拥有的值?extern crate num; // 0.2.0
use num::bigint::BigInt;
fn cal(a: BigInt, b: BigInt, floor: &BigInt) -> BigInt {
let c: BigInt = a - b;
if c.ge(floor) {
c
} else {
floor.clone()
}
}