Skip to main content

libutils_pointer/
conversions.rs

1//^
2//^ HEAD
3//^
4
5//> HEAD -> SUPER
6use super::Pointer;
7
8//> HEAD -> CORE
9use core::ptr::NonNull;
10
11
12//^
13//^ CONVERSIONS
14//^
15
16//> CONVERSIONS -> FROM NONNULL
17const impl<Type> From<NonNull<Type>> for Pointer<Type> {
18    fn from(value: NonNull<Type>) -> Self {return Self {
19        to: Some(value)
20    }}
21}
22
23//> CONVERSIONS -> FROM OPTION NONNULL
24const impl<Type> From<Option<NonNull<Type>>> for Pointer<Type> {
25    fn from(value: Option<NonNull<Type>>) -> Self {return Self {
26        to: value
27    }}
28}