-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Is there a way to include a generic type param?
#[borrowme]
#[derive(Debug)]
pub struct GenericObj<'a, T: Clone> {
#[borrowme(borrow_with = Vec::as_slice)]
pub data: &'a [T],
}or possibly a simpler variant
#[borrowme]
#[derive(Debug)]
pub struct PhantomGenericObj<'a, T> {
#[borrowme(borrow_with = Vec::as_slice)]
data: &'a [u8],
_marker: std::marker::PhantomData<T>,
}In both cases I get this error:
16 | #[borrowme]
| ----------- the parameter type `T` must be valid for the lifetime `'this` as defined here...
17 | #[derive(Debug)]
18 | pub struct GenericObj<'a, T> {
| ^^^^^^^^^^^^^^^^ ...so that the type `OwnedGenericObj<T>` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
18 | pub struct GenericObj<'a, T> where T: 'this {
| ++++++++++++++
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels