Skip to content
Discussion options

You must be logged in to vote

Sorry for the slow reply. I think you can achieve this by using Py::new, although it's not well documented. I'd love to make this bit of PyO3's API better.

#[pymethods]
impl CredentialProvider {
    #[args(opts = "GetOptions::default()")]
    #[pyo3(text_signature = "($self, opts)")]
    fn get(&self, opts: GetOptions) -> PyResult<Py<CredentialProvider>> {
        Py::new((
            Credential,
            CredentialProvider(Box::new(self.0.get(opts.0)?.into_credential())),
        ))
    }
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by bachue
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants