How to extract a value from enum?

Hi, I'm trying to return the inner value from an enum, but I'm not getting it to work. So how I can make a function return different values?

Returning impl Debug means "I'm returning a single concrete type which I don't want to name", but Task and Note are two different types so it can't figure out exactly what you are returning.

Instead, you can "erase" the concrete type by returning the trait object &dyn Debug. Both Note and Task implement Debug, so &Note and &Task will automatically coerce to &dyn Debug.

pub enum BoardItem {

impl BoardItem {
    fn value(&self) -> &dyn std::fmt::Debug {
        match self {
            BoardItem::Task(t) => t,
            BoardItem::Note(n) => n,

Check out Using Trait Objects That Allow for Values of Different Types from The Rust Programming Language for a better explanation.