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

    fn complete_into<T>(self, target: &mut T)
    where
        Self: Sized,
        T: Assign<Self>
, { ... } }
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.

Provided methods

Completes the operation and stores the result in a target.

Examples
use rug::{Complete, Integer};
let mut complete = Integer::new();
Integer::fibonacci(12).complete_into(&mut complete);
assert_eq!(complete, 144);

Implementors