Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve methods documentation when using extendr with impl #256

Closed
daniellga opened this issue Mar 22, 2023 · 2 comments
Closed

Improve methods documentation when using extendr with impl #256

daniellga opened this issue Mar 22, 2023 · 2 comments

Comments

@daniellga
Copy link

For the following example, it seems only the docs for MySubmoduleClass are generated. Would it be possible to autogenerate also the docs for each method? I think it would be very nice, if doable, to be able to call ?MySubmoduleClass$new or ?MySubmoduleClass$set_a on the R side.

// Class for testing
#[derive(Default, Debug)]
struct MySubmoduleClass {
    a: i32,
}

/// Class for testing (exported)
/// @examples
/// x <- MySubmoduleClass$new()
/// x$a()
/// x$set_a(10)
/// x$a()
/// @export
#[extendr]
impl MySubmoduleClass {
    /// Method for making a new object.
    fn new() -> Self {
        Self { a: 0 }
    }
    
    /// Method for setting stuff.
    /// @param x a number
    fn set_a(& mut self, x: i32) {
        self.a = x;
    }
    
    /// Method for getting stuff.
    fn a(&self) -> i32 {
        self.a
    }
    
    /// Method for getting one's self.
    fn me(&self) -> &Self {
        self
    }
}
@Ilia-Kosenkov
Copy link
Member

It seems this is a limitation of R. I think this should be closed.

@JosiahParry
Copy link
Contributor

Indeed a limitation. See related issues commented or mentioned in r-lib/roxygen2#835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants