Here's my code:
struct Handle<'a, T> {
name: &'a str,
object: &'a T
}
pub trait Portable {
fn port_as(&self, name: &str) -> String;
}
impl dyn Portable {
pub fn make_handle(&self, name: &str) -> Handle<Self> {
Handle {name, object: self }
}
}
Here's the error:
```error[E0277]: the size for values of type (dyn logic::Portable + 'static) cannot be known at compilation time
--> src\logic.rs:13:46
|
13 | pub fn make_handle(&self, name: &str) -> Handle<Self> {
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait Sized is not implemented for (dyn logic::Portable + 'static)
note: required by a bound in Handle
--> src\logic.rs:3:19
|
3 | struct Handle<'a, T> {
| ^ required by this bound in Handle
help: consider relaxing the implicit Sized restriction
|
3 | struct Handle<'a, T: ?Sized> {
| ++++++++
I understand why T could be unsized, but Handle<T> is just two references and is sized, correct?