Skip to content

Commit df0d754

Browse files
committed
Bound With*::F with Has*
1 parent a3d8961 commit df0d754

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/conversion.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{
2-
FnPtr,
3-
markers::{self, Safe, Unsafe},
2+
FnPtr, HasAbi, HasSafety, markers::{self, Safe, Unsafe}
43
};
54

65
/// Helper trait to change the ABI of a function pointer type while preserving arity, safety, and signature.
@@ -15,19 +14,7 @@ where
1514
ArityMarker = Self::ArityMarker,
1615
SafetyMarker = Self::SafetyMarker,
1716
AbiMarker = Abi,
18-
>;
19-
}
20-
21-
/// Helper trait to change the return type of a function pointer type while preserving arity, safety, ABI, and signature.
22-
pub trait WithReturn<T>: FnPtr {
23-
/// The function pointer type with the requested safety (preserving ABI and signature).
24-
type F: FnPtr<
25-
Args = Self::Args,
26-
Output = T,
27-
ArityMarker = Self::ArityMarker,
28-
SafetyMarker = Self::SafetyMarker,
29-
AbiMarker = Self::AbiMarker,
30-
>;
17+
> + HasAbi<Abi>;
3118
}
3219

3320
/// Helper trait to change the safety of a function pointer type while preserving arity, ABI, and signature.
@@ -42,7 +29,7 @@ where
4229
ArityMarker = Self::ArityMarker,
4330
SafetyMarker = Safety,
4431
AbiMarker = Self::AbiMarker,
45-
>;
32+
> + HasSafety<Safety>;
4633
}
4734

4835
/// Helper trait to compute the safe version of a function pointer type while preserving arity, ABI, and signature.

0 commit comments

Comments
 (0)