/rust/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.100/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 | 6.34k | pub fn new(ptr: Box<T>) -> Self { |
33 | 6.34k | Own { |
34 | 6.34k | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, |
35 | 6.34k | } |
36 | 6.34k | } <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::new Line | Count | Source | 32 | 117 | pub fn new(ptr: Box<T>) -> Self { | 33 | 117 | Own { | 34 | 117 | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, | 35 | 117 | } | 36 | 117 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::new <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::new Line | Count | Source | 32 | 54 | pub fn new(ptr: Box<T>) -> Self { | 33 | 54 | Own { | 34 | 54 | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, | 35 | 54 | } | 36 | 54 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::new <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::new Line | Count | Source | 32 | 6.15k | pub fn new(ptr: Box<T>) -> Self { | 33 | 6.15k | Own { | 34 | 6.15k | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, | 35 | 6.15k | } | 36 | 6.15k | } |
<anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::new Line | Count | Source | 32 | 21 | pub fn new(ptr: Box<T>) -> Self { | 33 | 21 | Own { | 34 | 21 | ptr: unsafe { NonNull::new_unchecked(Box::into_raw(ptr)) }, | 35 | 21 | } | 36 | 21 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_migration::MigratableError>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<serde_json::error::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::new |
37 | | |
38 | 12.6k | pub fn cast<U: CastTo>(self) -> Own<U::Target> { |
39 | 12.6k | Own { |
40 | 12.6k | ptr: self.ptr.cast(), |
41 | 12.6k | } |
42 | 12.6k | } <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::cast::<anyhow::error::ErrorImpl> Line | Count | Source | 38 | 117 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 117 | Own { | 40 | 117 | ptr: self.ptr.cast(), | 41 | 117 | } | 42 | 117 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::cast::<anyhow::error::ErrorImpl> <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::cast::<anyhow::error::ErrorImpl> Line | Count | Source | 38 | 54 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 54 | Own { | 40 | 54 | ptr: self.ptr.cast(), | 41 | 54 | } | 42 | 54 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::error::ContextError<core::mem::manually_drop::ManuallyDrop<anyhow::Error>, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>> <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>> Line | Count | Source | 38 | 117 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 117 | Own { | 40 | 117 | ptr: self.ptr.cast(), | 41 | 117 | } | 42 | 117 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, core::mem::manually_drop::ManuallyDrop<hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<iced_x86::iced_error::IcedError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::arch::emulator::PlatformError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>> <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>> Line | Count | Source | 38 | 54 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 54 | Own { | 40 | 54 | ptr: self.ptr.cast(), | 41 | 54 | } | 42 | 54 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vmm_sys_util::fam::Error>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vmm_sys_util::errno::Error>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::vm::HypervisorVmError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::kvm::KvmError>>> 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<hypervisor::kvm::x86_64::XsaveStateError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<std::io::error::Error>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>> <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::cast::<anyhow::error::ErrorImpl> Line | Count | Source | 38 | 6.15k | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 6.15k | Own { | 40 | 6.15k | ptr: self.ptr.cast(), | 41 | 6.15k | } | 42 | 6.15k | } |
<anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::cast::<anyhow::error::ErrorImpl> Line | Count | Source | 38 | 21 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 21 | Own { | 40 | 21 | ptr: self.ptr.cast(), | 41 | 21 | } | 42 | 21 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>>::cast::<anyhow::error::ErrorImpl> <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>> Line | Count | Source | 38 | 6.15k | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 6.15k | Own { | 40 | 6.15k | ptr: self.ptr.cast(), | 41 | 6.15k | } | 42 | 6.15k | } |
<anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>> Line | Count | Source | 38 | 21 | pub fn cast<U: CastTo>(self) -> Own<U::Target> { | 39 | 21 | Own { | 40 | 21 | ptr: self.ptr.cast(), | 41 | 21 | } | 42 | 21 | } |
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>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_migration::MigratableError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<serde_json::error::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vm_migration::MigratableError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::hypervisor::HypervisorError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<serde_json::error::Error>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vm_memory::guest_memory::Error>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vm_migration::MigratableError>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<serde_json::error::Error>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::cpu::HypervisorCpuError>>> Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>> |
43 | | |
44 | 6.34k | pub unsafe fn boxed(self) -> Box<T> { |
45 | 6.34k | unsafe { Box::from_raw(self.ptr.as_ptr()) } |
46 | 6.34k | } Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::error::ContextError<core::mem::manually_drop::ManuallyDrop<anyhow::Error>, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::boxed <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::boxed Line | Count | Source | 44 | 117 | pub unsafe fn boxed(self) -> Box<T> { | 45 | 117 | unsafe { Box::from_raw(self.ptr.as_ptr()) } | 46 | 117 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, core::mem::manually_drop::ManuallyDrop<hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<iced_x86::iced_error::IcedError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::arch::emulator::PlatformError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::boxed <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::boxed Line | Count | Source | 44 | 54 | pub unsafe fn boxed(self) -> Box<T> { | 45 | 54 | unsafe { Box::from_raw(self.ptr.as_ptr()) } | 46 | 54 | } |
Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vmm_sys_util::fam::Error>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vmm_sys_util::errno::Error>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::vm::HypervisorVmError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::kvm::KvmError>>>>::boxed 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<hypervisor::kvm::x86_64::XsaveStateError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<std::io::error::Error>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::boxed <anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>>::boxed Line | Count | Source | 44 | 6.15k | pub unsafe fn boxed(self) -> Box<T> { | 45 | 6.15k | unsafe { Box::from_raw(self.ptr.as_ptr()) } | 46 | 6.15k | } |
<anyhow::ptr::Own<anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>>::boxed Line | Count | Source | 44 | 21 | pub unsafe fn boxed(self) -> Box<T> { | 45 | 21 | unsafe { Box::from_raw(self.ptr.as_ptr()) } | 46 | 21 | } |
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<vm_migration::MigratableError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::hypervisor::HypervisorError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<serde_json::error::Error>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<vm_memory::guest_memory::Error>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_migration::MigratableError>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<serde_json::error::Error>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<core::mem::manually_drop::ManuallyDrop<hypervisor::cpu::HypervisorCpuError>>>>::boxed Unexecuted instantiation: <anyhow::ptr::Own<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::boxed |
47 | | |
48 | 0 | pub fn by_ref(&self) -> Ref<T> { |
49 | 0 | Ref { |
50 | 0 | ptr: self.ptr, |
51 | 0 | lifetime: PhantomData, |
52 | 0 | } |
53 | 0 | } |
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<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::Error>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::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<vm_migration::MigratableError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<serde_json::error::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::new Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::new |
93 | | |
94 | | #[cfg(not(anyhow_no_ptr_addr_of))] |
95 | 0 | pub fn from_raw(ptr: NonNull<T>) -> Self { |
96 | 0 | Ref { |
97 | 0 | ptr, |
98 | 0 | lifetime: PhantomData, |
99 | 0 | } |
100 | 0 | } Unexecuted instantiation: <anyhow::ptr::Ref<iced_x86::iced_error::IcedError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::arch::emulator::PlatformError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<vmm_sys_util::fam::Error>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<vmm_sys_util::errno::Error>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::vm::HypervisorVmError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::kvm::KvmError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::kvm::x86_64::XsaveStateError>>::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 Unexecuted instantiation: <anyhow::ptr::Ref<vm_migration::MigratableError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::hypervisor::HypervisorError>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<serde_json::error::Error>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<vm_memory::guest_memory::Error>>::from_raw Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::cpu::HypervisorCpuError>>::from_raw |
101 | | |
102 | 0 | pub fn cast<U: CastTo>(self) -> Ref<'a, U::Target> { |
103 | 0 | Ref { |
104 | 0 | ptr: self.ptr.cast(), |
105 | 0 | lifetime: PhantomData, |
106 | 0 | } |
107 | 0 | } Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>> Unexecuted instantiation: <anyhow::ptr::Ref<iced_x86::iced_error::IcedError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::arch::emulator::PlatformError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>> 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<hypervisor::kvm::x86_64::XsaveStateError>> Unexecuted instantiation: <anyhow::ptr::Ref<vmm_sys_util::fam::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<vmm_sys_util::errno::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::vm::HypervisorVmError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::kvm::KvmError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<std::io::error::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::kvm::x86_64::XsaveStateError>>::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<vm_migration::MigratableError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<serde_json::error::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<vm_migration::MigratableError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vm_migration::MigratableError>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<serde_json::error::Error>> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::hypervisor::HypervisorError>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<serde_json::error::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<vm_memory::guest_memory::Error>>::cast::<()> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::cast::<anyhow::error::ErrorImpl> Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::cast::<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>> Unexecuted instantiation: <anyhow::ptr::Ref<hypervisor::cpu::HypervisorCpuError>>::cast::<()> |
108 | | |
109 | | #[cfg(not(anyhow_no_ptr_addr_of))] |
110 | 0 | pub fn by_mut(self) -> Mut<'a, T> { |
111 | 0 | Mut { |
112 | 0 | ptr: self.ptr, |
113 | 0 | lifetime: PhantomData, |
114 | 0 | } |
115 | 0 | } |
116 | | |
117 | | #[cfg(not(anyhow_no_ptr_addr_of))] |
118 | 0 | pub fn as_ptr(self) -> *const T { |
119 | 0 | self.ptr.as_ptr() as *const T |
120 | 0 | } Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<iced_x86::iced_error::IcedError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::arch::emulator::PlatformError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::fam::Error>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vmm_sys_util::errno::Error>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::vm::HypervisorVmError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::KvmError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<std::io::error::Error>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::kvm::x86_64::XsaveStateError>>>::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 Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vm_migration::MigratableError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::hypervisor::HypervisorError>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<serde_json::error::Error>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<vm_memory::guest_memory::Error>>>::as_ptr Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<hypervisor::cpu::HypervisorCpuError>>>::as_ptr |
121 | | |
122 | 0 | pub unsafe fn deref(self) -> &'a T { |
123 | 0 | unsafe { &*self.ptr.as_ptr() } |
124 | 0 | } Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl<anyhow::error::ContextError<anyhow::Error, hypervisor::arch::emulator::EmulationError<hypervisor::arch::x86::Exception>>>>>::deref Unexecuted instantiation: <anyhow::ptr::Ref<dyn core::error::Error + core::marker::Sync + core::marker::Send>>::deref Unexecuted instantiation: <anyhow::ptr::Ref<anyhow::error::ErrorImpl>>::deref |
125 | | } |
126 | | |
127 | | #[repr(transparent)] |
128 | | pub struct Mut<'a, T> |
129 | | where |
130 | | T: ?Sized, |
131 | | { |
132 | | pub ptr: NonNull<T>, |
133 | | lifetime: PhantomData<&'a mut T>, |
134 | | } |
135 | | |
136 | | impl<'a, T> Copy for Mut<'a, T> where T: ?Sized {} |
137 | | |
138 | | impl<'a, T> Clone for Mut<'a, T> |
139 | | where |
140 | | T: ?Sized, |
141 | | { |
142 | 0 | fn clone(&self) -> Self { |
143 | 0 | *self |
144 | 0 | } |
145 | | } |
146 | | |
147 | | impl<'a, T> Mut<'a, T> |
148 | | where |
149 | | T: ?Sized, |
150 | | { |
151 | | #[cfg(anyhow_no_ptr_addr_of)] |
152 | | pub fn new(ptr: &'a mut T) -> Self { |
153 | | Mut { |
154 | | ptr: NonNull::from(ptr), |
155 | | lifetime: PhantomData, |
156 | | } |
157 | | } |
158 | | |
159 | 0 | pub fn cast<U: CastTo>(self) -> Mut<'a, U::Target> { |
160 | 0 | Mut { |
161 | 0 | ptr: self.ptr.cast(), |
162 | 0 | lifetime: PhantomData, |
163 | 0 | } |
164 | 0 | } |
165 | | |
166 | | #[cfg(not(anyhow_no_ptr_addr_of))] |
167 | 0 | pub fn by_ref(self) -> Ref<'a, T> { |
168 | 0 | Ref { |
169 | 0 | ptr: self.ptr, |
170 | 0 | lifetime: PhantomData, |
171 | 0 | } |
172 | 0 | } |
173 | | |
174 | 0 | pub fn extend<'b>(self) -> Mut<'b, T> { |
175 | 0 | Mut { |
176 | 0 | ptr: self.ptr, |
177 | 0 | lifetime: PhantomData, |
178 | 0 | } |
179 | 0 | } |
180 | | |
181 | 0 | pub unsafe fn deref_mut(self) -> &'a mut T { |
182 | 0 | unsafe { &mut *self.ptr.as_ptr() } |
183 | 0 | } |
184 | | } |
185 | | |
186 | | impl<'a, T> Mut<'a, T> { |
187 | 0 | pub unsafe fn read(self) -> T { |
188 | 0 | unsafe { self.ptr.as_ptr().read() } |
189 | 0 | } |
190 | | } |
191 | | |
192 | | // Force turbofish on all calls of `.cast::<U>()`. |
193 | | pub trait CastTo { |
194 | | type Target; |
195 | | } |
196 | | |
197 | | impl<T> CastTo for T { |
198 | | type Target = T; |
199 | | } |