Return with move semantics

Is that possible to use the move semantic when returning a value from a function?
The code below would give error:
from tensor import Tensor


struct Value[dtype: DType]:
    alias TensorD = Tensor[dtype]
    var data: Self.TensorD

    fn __init__(inout self):
        self.data = Self.TensorD()

    fn foo(self) -> Self:
        var v = Self()
        return v


fn main():
    alias FValue = Value[DType.float16]
    var v1 = FValue()
    var v2 = FValue()
    var v3 = v1.foo()

error: 'Value[dtype]' is not copyable because it has no 'copyinit'
return v
^
mojo: error: failed to parse the provided Mojo source module
Was this page helpful?