sel4_abstract_rc/
lib.rs

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
//
// Copyright 2024, Colias Group, LLC
//
// SPDX-License-Identifier: BSD-2-Clause
//

#![no_std]

extern crate alloc;

use alloc::rc::Rc;
use alloc::sync::Arc;
use core::ops::Deref;

pub trait AbstractRcT {
    type Rc<T>: AbstractRc<T>;
}

pub struct RcT(());

impl AbstractRcT for RcT {
    type Rc<T> = Rc<T>;
}

pub struct ArcT(());

impl AbstractRcT for ArcT {
    type Rc<T> = Arc<T>;
}

pub trait AbstractRc<T>: Deref<Target = T> + From<T> + Clone {}

impl<T> AbstractRc<T> for Rc<T> {}

impl<T> AbstractRc<T> for Arc<T> {}