summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 90cef27..7ce25cb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,7 @@
 // SPDX-License-Identifier: 0BSD
 
 #![cfg_attr(not(feature="std"),no_std)]
+#![deny(unsafe_op_in_unsafe_fn)]
 
 //! This crate provides "checked" raw pointers.
 //!
@@ -107,6 +108,13 @@ pub trait AsLtPtr {
     fn as_lt_ptr<'a>(&'a self) -> ConstLtPtr<'a, Self::Target>;
 }
 
+/// Trait for conversion from a [`ConstLtPtr`] of the given `Source` type.
+pub trait FromLtPtr<Source> {
+    /// Returns a value as if by `from_ptr` on a type that implements this, but
+    /// with a bound lifetime.
+    unsafe fn from_lt_ptr<'a>(ptr: ConstLtPtr<'a, Source>) -> &'a Self;
+}
+
 /// Trait for conversion into a [`MutLtPtr`].
 pub trait AsMutLtPtr: AsLtPtr {
     /// Returns a pointer as if by `as_ptr` on a type that implements this, but