I'm new to Rust and PyO3 (coming from Python) so this might be obvious to more experienced people.
I declared a pyclass struct in PyO3.
#[pyclass]
struct Block {
start: i32,
stop: i32,
}
Then I use Block
in a rust function that takes a vector of Block
and outputs a vector of int (signature below)
#[pyfunction]
fn from_blocks(block_list: Vec<Block>) -> Vec<i32>
When I compile using nightly-x86_64-apple-darwin
I get the following error:
#[pyfunction]
^^^^^^^^^^^^^ the trait `pyo3::FromPyObject<'_>` is not implemented for `std::vec::Vec<Block>`
How do I solve this?
EDIT: Caio is right. I made a mistake in tracing back the error. Previously I wrote
Then I use Block in a rust function that takes a vector of int and outputs a vector of Block (signature below)
#[pyfunction]
fn to_blocks(list: Vec<i32>) -> Vec<Block>
But the actual offending function is:
#[pyfunction]
fn from_blocks(block_list: Vec<Block>) -> Vec<i32>
I've updated the question to make it clearer.