summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-08-12 15:29:07 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-08-12 15:29:07 -0300
commit0cbd0b9b701c4d067b8dd0fdccc0ebe5c6b6e7e1 (patch)
tree81bc4c10dd73a94bd1356ce8ba6ce2ddd2ddb27a /src/lib.rs
parentb76b71507dbd567b2c7f98228783a6dfc8a7bec5 (diff)
Provide ConstLtPtr to CStr conversion
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