Coverage Report

Created: 2026-02-14 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.101/src/ptr.rs
Line
Count
Source
1
use alloc::boxed::Box;
2
use core::marker::PhantomData;
3
use core::ptr::NonNull;
4
5
#[repr(transparent)]
6
pub struct Own<T>
7
where
8
    T: ?Sized,
9
{
10
    pub ptr: NonNull<T>,
11
}
12
13
unsafe impl<T> Send for Own<T> where T: ?Sized {}
14
15
unsafe impl<T> Sync for Own<T> where T: ?Sized {}
16
17
impl<T> Copy for Own<T> where T: ?Sized {}
18
19
impl<T> Clone for Own<T>
20
where
21
    T: ?Sized,
22
{
23
0
    fn clone(&self) -> Self {
24
0
        *self
25
0
    }
26
}
27
28
impl<T> Own<T>
29
where
30
    T: ?Sized,
31
{
32
12.8k
    pub fn new(ptr: Box<T>) -> Self {
33
12.8k
        Own {
34
12.8k
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
12.8k
        }
36
12.8k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::new
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::new
Line
Count
Source
32
850
    pub fn new(ptr: Box<T>) -> Self {
33
850
        Own {
34
850
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
850
        }
36
850
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::new
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::new
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::new
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config_value::Error>>>::new
Line
Count
Source
32
2.61k
    pub fn new(ptr: Box<T>) -> Self {
33
2.61k
        Own {
34
2.61k
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
2.61k
        }
36
2.61k
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::new
Line
Count
Source
32
960
    pub fn new(ptr: Box<T>) -> Self {
33
960
        Own {
34
960
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
960
        }
36
960
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::new
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::new
Line
Count
Source
32
912
    pub fn new(ptr: Box<T>) -> Self {
33
912
        Own {
34
912
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
912
        }
36
912
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::new
Line
Count
Source
32
1.99k
    pub fn new(ptr: Box<T>) -> Self {
33
1.99k
        Own {
34
1.99k
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
1.99k
        }
36
1.99k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::new
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::new
Line
Count
Source
32
907
    pub fn new(ptr: Box<T>) -> Self {
33
907
        Own {
34
907
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
907
        }
36
907
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::new
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::new
Line
Count
Source
32
958
    pub fn new(ptr: Box<T>) -> Self {
33
958
        Own {
34
958
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
958
        }
36
958
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::new
Line
Count
Source
32
1.57k
    pub fn new(ptr: Box<T>) -> Self {
33
1.57k
        Own {
34
1.57k
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
1.57k
        }
36
1.57k
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::new
Line
Count
Source
32
2.03k
    pub fn new(ptr: Box<T>) -> Self {
33
2.03k
        Own {
34
2.03k
            ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) },
35
2.03k
        }
36
2.03k
    }
37
38
25.6k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
25.6k
        Own {
40
25.6k
            ptr: self.ptr.cast(),
41
25.6k
        }
42
25.6k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::cast::<anyhow::error::ErrorImpl>
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
850
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
850
        Own {
40
850
            ptr: self.ptr.cast(),
41
850
        }
42
850
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::lookup::existing::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::file::init::types::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::parse::section::types::value_name::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>
Line
Count
Source
38
850
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
850
        Own {
40
850
            ptr: self.ptr.cast(),
41
850
        }
42
850
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<alloc::string::String>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<&str>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config_value::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
2.61k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
2.61k
        Own {
40
2.61k
            ptr: self.ptr.cast(),
41
2.61k
        }
42
2.61k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config_value::Error>>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config_value::Error>>
Line
Count
Source
38
2.61k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
2.61k
        Own {
40
2.61k
            ptr: self.ptr.cast(),
41
2.61k
        }
42
2.61k
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
960
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
960
        Own {
40
960
            ptr: self.ptr.cast(),
41
960
        }
42
960
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::cast::<anyhow::error::ErrorImpl>
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
912
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
912
        Own {
40
912
            ptr: self.ptr.cast(),
41
912
        }
42
912
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_validate::reference::name::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::packed::iter::error::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::packed::buffer::open::error::Error>>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>
Line
Count
Source
38
960
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
960
        Own {
40
960
            ptr: self.ptr.cast(),
41
960
        }
42
960
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>
Line
Count
Source
38
912
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
912
        Own {
40
912
            ptr: self.ptr.cast(),
41
912
        }
42
912
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
1.99k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
1.99k
        Own {
40
1.99k
            ptr: self.ptr.cast(),
41
1.99k
        }
42
1.99k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_validate::reference::name::Error>>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>
Line
Count
Source
38
1.99k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
1.99k
        Own {
40
1.99k
            ptr: self.ptr.cast(),
41
1.99k
        }
42
1.99k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl>
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
907
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
907
        Own {
40
907
            ptr: self.ptr.cast(),
41
907
        }
42
907
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<std::io::error::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::file::log::line::decode::error::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<std::io::error::Error>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>
Line
Count
Source
38
907
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
907
        Own {
40
907
            ptr: self.ptr.cast(),
41
907
        }
42
907
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl>
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
958
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
958
        Own {
40
958
            ptr: self.ptr.cast(),
41
958
        }
42
958
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<std::io::error::Error>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_error::concrete::message::Message>>>
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<std::io::error::Error>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>
Line
Count
Source
38
958
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
958
        Own {
40
958
            ptr: self.ptr.cast(),
41
958
        }
42
958
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
1.57k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
1.57k
        Own {
40
1.57k
            ptr: self.ptr.cast(),
41
1.57k
        }
42
1.57k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_url::parse::Error>>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_url::parse::Error>>
Line
Count
Source
38
1.57k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
1.57k
        Own {
40
1.57k
            ptr: self.ptr.cast(),
41
1.57k
        }
42
1.57k
    }
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::cast::<anyhow::error::ErrorImpl>
Line
Count
Source
38
2.03k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
2.03k
        Own {
40
2.03k
            ptr: self.ptr.cast(),
41
2.03k
        }
42
2.03k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_pathspec::parse::Error>>>
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>
Line
Count
Source
38
2.03k
    pub fn cast<U: CastTo>(self) -> Own<U::Target> {
39
2.03k
        Own {
40
2.03k
            ptr: self.ptr.cast(),
41
2.03k
        }
42
2.03k
    }
43
44
12.8k
    pub unsafe fn boxed(self) -> Box<T> {
45
12.8k
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
12.8k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::lookup::existing::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::file::init::types::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config::parse::section::types::value_name::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::boxed
Line
Count
Source
44
850
    pub unsafe fn boxed(self) -> Box<T> {
45
850
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
850
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<alloc::string::String>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<&str>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_config_value::Error>>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_config_value::Error>>>::boxed
Line
Count
Source
44
2.61k
    pub unsafe fn boxed(self) -> Box<T> {
45
2.61k
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
2.61k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_validate::reference::name::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::packed::iter::error::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::packed::buffer::open::error::Error>>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::boxed
Line
Count
Source
44
960
    pub unsafe fn boxed(self) -> Box<T> {
45
960
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
960
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::boxed
Line
Count
Source
44
912
    pub unsafe fn boxed(self) -> Box<T> {
45
912
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
912
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_validate::reference::name::Error>>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::boxed
Line
Count
Source
44
1.99k
    pub unsafe fn boxed(self) -> Box<T> {
45
1.99k
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
1.99k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<std::io::error::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_ref::store_impl::file::log::line::decode::error::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::boxed
Line
Count
Source
44
907
    pub unsafe fn boxed(self) -> Box<T> {
45
907
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
907
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<std::io::error::Error>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_error::concrete::message::Message>>>>::boxed
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::boxed
Line
Count
Source
44
958
    pub unsafe fn boxed(self) -> Box<T> {
45
958
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
958
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_url::parse::Error>>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::boxed
Line
Count
Source
44
1.57k
    pub unsafe fn boxed(self) -> Box<T> {
45
1.57k
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
1.57k
    }
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<gix_pathspec::parse::Error>>>>::boxed
<anyhow::ptr::Own<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::boxed
Line
Count
Source
44
2.03k
    pub unsafe fn boxed(self) -> Box<T> {
45
2.03k
        unsafe { Box::from_raw(self.ptr.as_ptr()) }
46
2.03k
    }
47
48
5.23k
    pub fn by_ref(&self) -> Ref<T> {
49
5.23k
        Ref {
50
5.23k
            ptr: self.ptr,
51
5.23k
            lifetime: PhantomData,
52
5.23k
        }
53
5.23k
    }
54
55
0
    pub fn by_mut(&mut self) -> Mut<T> {
56
0
        Mut {
57
0
            ptr: self.ptr,
58
0
            lifetime: PhantomData,
59
0
        }
60
0
    }
61
}
62
63
#[repr(transparent)]
64
pub struct Ref<'a, T>
65
where
66
    T: ?Sized,
67
{
68
    pub ptr: NonNull<T>,
69
    lifetime: PhantomData<&'a T>,
70
}
71
72
impl<'a, T> Copy for Ref<'a, T> where T: ?Sized {}
73
74
impl<'a, T> Clone for Ref<'a, T>
75
where
76
    T: ?Sized,
77
{
78
0
    fn clone(&self) -> Self {
79
0
        *self
80
0
    }
81
}
82
83
impl<'a, T> Ref<'a, T>
84
where
85
    T: ?Sized,
86
{
87
0
    pub fn new(ptr: &'a T) -> Self {
88
0
        Ref {
89
0
            ptr: NonNull::from(ptr),
90
0
            lifetime: PhantomData,
91
0
        }
92
0
    }
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config_value::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::new
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::new
93
94
5.23k
    pub fn from_raw(ptr: NonNull<T>) -> Self {
95
5.23k
        Ref {
96
5.23k
            ptr,
97
5.23k
            lifetime: PhantomData,
98
5.23k
        }
99
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::lookup::existing::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::file::init::types::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::parse::section::types::value_name::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<alloc::string::String>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<&str>>::from_raw
<anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Line
Count
Source
94
5.23k
    pub fn from_raw(ptr: NonNull<T>) -> Self {
95
5.23k
        Ref {
96
5.23k
            ptr,
97
5.23k
            lifetime: PhantomData,
98
5.23k
        }
99
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config_value::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_validate::reference::name::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::packed::iter::error::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::packed::buffer::open::error::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_validate::reference::name::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::file::log::line::decode::error::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_error::concrete::message::Message>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_url::parse::Error>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::from_raw
Unexecuted instantiation: <anyhow::ptr::Ref<gix_pathspec::parse::Error>>::from_raw
100
101
5.23k
    pub fn cast<U: CastTo>(self) -> Ref<'a, U::Target> {
102
5.23k
        Ref {
103
5.23k
            ptr: self.ptr.cast(),
104
5.23k
            lifetime: PhantomData,
105
5.23k
        }
106
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::lookup::existing::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::file::init::types::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config::parse::section::types::value_name::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<alloc::string::String>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<&str>>
Unexecuted instantiation: <anyhow::ptr::Ref<alloc::string::String>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<&str>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config_value::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_config_value::Error>>::cast::<()>
<anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_config_value::Error>>
Line
Count
Source
101
5.23k
    pub fn cast<U: CastTo>(self) -> Ref<'a, U::Target> {
102
5.23k
        Ref {
103
5.23k
            ptr: self.ptr.cast(),
104
5.23k
            lifetime: PhantomData,
105
5.23k
        }
106
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_validate::reference::name::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::packed::iter::error::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::packed::buffer::open::error::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_validate::reference::name::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<std::io::error::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_ref::store_impl::file::log::line::decode::error::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<std::io::error::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>
Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_error::concrete::message::Message>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_url::parse::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_url::parse::Error>>::cast::<()>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::cast::<anyhow::error::ErrorImpl>
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>
Unexecuted instantiation: <anyhow::ptr::Ref<gix_pathspec::parse::Error>>::cast::<()>
107
108
0
    pub fn by_mut(self) -> Mut<'a, T> {
109
0
        Mut {
110
0
            ptr: self.ptr,
111
0
            lifetime: PhantomData,
112
0
        }
113
0
    }
114
115
5.23k
    pub fn as_ptr(self) -> *const T {
116
5.23k
        self.ptr.as_ptr().cast_const()
117
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::lookup::existing::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::file::init::types::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config::parse::section::types::value_name::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<alloc::string::String>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<&str>>>::as_ptr
<anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_config_value::Error>>>::as_ptr
Line
Count
Source
115
5.23k
    pub fn as_ptr(self) -> *const T {
116
5.23k
        self.ptr.as_ptr().cast_const()
117
5.23k
    }
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::iter::error::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::packed::buffer::open::error::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_validate::reference::name::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_ref::store_impl::file::log::line::decode::error::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_error::concrete::message::Message>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_url::parse::Error>>>::as_ptr
Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<gix_pathspec::parse::Error>>>::as_ptr
118
119
7.84k
    pub unsafe fn deref(self) -> &'a T {
120
7.84k
        unsafe { &*self.ptr.as_ptr() }
121
7.84k
    }
<anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::deref
Line
Count
Source
119
5.23k
    pub unsafe fn deref(self) -> &'a T {
120
5.23k
        unsafe { &*self.ptr.as_ptr() }
121
5.23k
    }
<anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::deref
Line
Count
Source
119
2.61k
    pub unsafe fn deref(self) -> &'a T {
120
2.61k
        unsafe { &*self.ptr.as_ptr() }
121
2.61k
    }
122
}
123
124
#[repr(transparent)]
125
pub struct Mut<'a, T>
126
where
127
    T: ?Sized,
128
{
129
    pub ptr: NonNull<T>,
130
    lifetime: PhantomData<&'a mut T>,
131
}
132
133
impl<'a, T> Copy for Mut<'a, T> where T: ?Sized {}
134
135
impl<'a, T> Clone for Mut<'a, T>
136
where
137
    T: ?Sized,
138
{
139
0
    fn clone(&self) -> Self {
140
0
        *self
141
0
    }
142
}
143
144
impl<'a, T> Mut<'a, T>
145
where
146
    T: ?Sized,
147
{
148
0
    pub fn cast<U: CastTo>(self) -> Mut<'a, U::Target> {
149
0
        Mut {
150
0
            ptr: self.ptr.cast(),
151
0
            lifetime: PhantomData,
152
0
        }
153
0
    }
154
155
0
    pub fn by_ref(self) -> Ref<'a, T> {
156
0
        Ref {
157
0
            ptr: self.ptr,
158
0
            lifetime: PhantomData,
159
0
        }
160
0
    }
161
162
0
    pub fn extend<'b>(self) -> Mut<'b, T> {
163
0
        Mut {
164
0
            ptr: self.ptr,
165
0
            lifetime: PhantomData,
166
0
        }
167
0
    }
168
169
0
    pub unsafe fn deref_mut(self) -> &'a mut T {
170
0
        unsafe { &mut *self.ptr.as_ptr() }
171
0
    }
172
}
173
174
impl<'a, T> Mut<'a, T> {
175
0
    pub unsafe fn read(self) -> T {
176
0
        unsafe { self.ptr.as_ptr().read() }
177
0
    }
178
}
179
180
// Force turbofish on all calls of `.cast::<U>()`.
181
pub trait CastTo {
182
    type Target;
183
}
184
185
impl<T> CastTo for T {
186
    type Target = T;
187
}