Debian Codegraph @

src/mem.rs

raw symbols SCIP
1 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/::Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#;
2 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#, fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#};
3
4 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:)]
5 pub struct Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<T>(pub Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#<T>);
6
7 impl<T> Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# for Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<T> {
8 fn clonerust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Clone]clone().(&self) -> Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Clone] {
9 Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Clone](self.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Clone]clone().())
10 }
11 }
12
13 impl<T> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<T>
14 where
15 T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#,
16 {
17 fn fmtrust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
18 self.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0..fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Debug]fmt().(f)
19 }
20 }
21
22 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:)]
23 #[repr(transparent)]
24 pub struct Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(pub T);
25
26 impl<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<T> {
27 pub fn wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(value: &T) -> &Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`] {
28 // safe because Wrapper<T> is #[repr(transparent)]
29 unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(value as *const T as *const Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]) }
30 }
31
32 pub fn wrap_boundrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap_bound().(bound: Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&T>) -> Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]> {
33 match bound {
34 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(t) => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(t)),
35 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(t) => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(Selfrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(t)),
36 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded# => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#,
37 }
38 }
39 }
40
41 impl<K, Q> Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<Q>> for Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<K>
42 where
43 K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>,
44 Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#,
45 {
46 fn borrowrust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<K>`][`Borrow<Wrapper<Q>>`]borrow().(&self) -> &Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<Q> {
47 // Rc<K>: Borrow<K>
48 let k: &K = self.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0..borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][`Borrow<T>`]borrow().();
49 // K: Borrow<Q>
50 let q: &Q = k.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().();
51
52 Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(q)
53 }
54 }