我试图得到一个Vec<Option<String>>
,这样我就可以把它传递给sql,而null值不变.基于this SO question,我试过:
let names: Vec<Option<String>> = merged_df
.column("description")?
.str()?
.into_iter()
.map(|s| s.to_string())
.collect();
但这是失败的:
1 error[E0599]: the method `to_string` exists for enum `Option<&str>`, but its trait bounds were not satisfied
--> rust/load_all.rs:569:20
|
569 | .map(|s| s.to_string())
| ^^^^^^^^^ method cannot be called on `Option<&str>` due to unsatisfied trait bounds
|
::: /Users/nick/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:570:1
|
570 | pub enum Option<T> {
| ------------------ doesn't satisfy `_: TemporalMethods`, `std::option::Option<&str>: AsSeries`, `std::option::Option<&str>: ToString
` or `std::option::Option<&str>: std::fmt::Display`
|
= note: the following trait bounds were not satisfied:
`std::option::Option<&str>: AsSeries`
which is required by `std::option::Option<&str>: polars::prelude::TemporalMethods`
`std::option::Option<&str>: std::fmt::Display`
which is required by `std::option::Option<&str>: ToString`
我怎么才能让它工作?