First of all I think the subject I selected may be wrong because I'm not sure how this is called!
What I'm looking is something similar to the below, I'm using a rust library with ATOM IDE, when I hover at any function name, I get a dialog showing:
- Function Signature,
- Explanation about the function
- Example paragraph
- Failure paragraph
How can I make same for the library I'm writing?
I figured it out from the library git.
It is using ///
abive the function, and using #
for titles required in bold, for the function I'm using above, below is what I got:
/// Convenience method to prepare and execute a single SQL statement.
///
/// On success, returns the number of rows that were changed or inserted or
/// deleted (via `sqlite3_changes`).
///
/// ## Example
///
/// ```rust,no_run
/// # use rusqlite::{Connection};
/// fn update_rows(conn: &Connection) {
/// match conn.execute("UPDATE foo SET bar = 'baz' WHERE qux = ?", &[1i32]) {
/// Ok(updated) => println!("{} rows were updated", updated),
/// Err(err) => println!("update failed: {}", err),
/// }
/// }
/// ```
///
/// # Failure
///
/// Will return `Err` if `sql` cannot be converted to a C-compatible string
/// or if the underlying SQLite call fails.
pub fn execute<P>(&self, sql: &str, params: P) -> Result<usize>
where
P: IntoIterator,
P::Item: ToSql,
{
self.prepare(sql).and_then(|mut stmt| stmt.execute(params))
}
I can't find it in the new edition, but the first edition book describes documentation here:
https://doc.rust-lang.org/book/first-edition/documentation.html
1 Like
Thanks, just found this that is this