1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use super::super::prelude::*;

use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::sync::Arc;
use alloc::vec::Vec;
use core::alloc::Allocator;

verus! {

#[verifier::external_fn_specification]
pub fn box_into_vec<T, A: Allocator>(b: Box<[T], A>) -> (v: Vec<T, A>)
    ensures
        v@ == b@,
{
    b.into_vec()
}

#[verifier::external_fn_specification]
pub fn box_new<T>(t: T) -> (v: Box<T>)
    ensures
        v == t,
{
    Box::new(t)
}

#[verifier::external_fn_specification]
pub fn rc_new<T>(t: T) -> (v: Rc<T>)
    ensures
        v == t,
{
    Rc::new(t)
}

#[verifier::external_fn_specification]
pub fn arc_new<T>(t: T) -> (v: Arc<T>)
    ensures
        v == t,
{
    Arc::new(t)
}

#[verifier::external_fn_specification]
pub fn box_clone<T: Clone, A: Allocator + Clone>(b: &Box<T, A>) -> (res: Box<T, A>)
    ensures
        call_ensures(T::clone, (&**b,), *res),
{
    b.clone()
}

} // verus!