Convert &A to &[A]?

Hello,

Let's say I have some type, for example

struct Cell { 
  dna: String 
}

Further, I have this trait:

trait Living {
  fn cells(&self) -> &[Cell]
}

Now I want Cell to implement Living. But how do I implement cells? How can I get a &[Cell] from &self, which is &Cell?

Thanks!

Best, Oliver

10 Likes

Awesome, thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.