Trait rug::Complete[][src]

pub trait Complete {
    type Completed;
    fn complete(self) -> Self::Completed;
}
Expand description

Completes an incomplete-computation value.

Examples

Implementing the trait:

use rug::{Complete, Integer};
struct LazyPow4<'a>(&'a Integer);
impl Complete for LazyPow4<'_> {
    type Completed = Integer;
    fn complete(self) -> Integer {
        self.0.clone().square().square()
    }
}

assert_eq!(LazyPow4(&Integer::from(3)).complete(), 3i32.pow(4));

Completing an incomplete-computation value:

use rug::{Complete, Integer};
let incomplete = Integer::fibonacci(12);
let complete = incomplete.complete();
assert_eq!(complete, 144);

Associated Types

The type of the completed operation.

Required methods

Completes the operation.

Implementors