خرید بک لینک

Vote count: 1

I am going to demonstrate a small piece of code:
in Cargo.toml:

[dependencies]
num = "0.1.32"

in main.rs:

exte crate num;
use num::bigint::{BigInt, ToBigInt};

fn cal(a: BigInt, b: BigInt, floor: &BigInt) -> BigInt {
    let c : BigInt = a- b ;
    if  c .ge( floor ) {
        c
    } else  {
        floor.clone()
    }
}

My questions is, how can I retu the reference of floor instead of the a new object? Is it possible let the function retu borrowed reference or ownership? Thanks!

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 31 فروردين 1395 ساعت: 7:34

صفحه بندی