Skip to content

Commit

Permalink
chore: add comments to exports in user impl module
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Sep 3, 2024
1 parent 2ab4ffe commit f6a5d26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function capitalize(s: string) {
}

function camelToSnakeCase(s: string) {
return s.split(/(?=[A-Z])/).join('_').toLowerCase()
return s.split(/(?=[A-Z])/).join("_").toLowerCase();
}

export function render() {
Expand All @@ -97,7 +97,7 @@ export function render() {
makePublic,
jsonWrappedRustType,
capitalize,
camelToSnakeCase
camelToSnakeCase,
};

const output = ejs.render(tmpl, ctx);
Expand Down
6 changes: 4 additions & 2 deletions template/src/lib.rs.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
mod pdk;
use pdk::*;

use pdk::*;
use extism_pdk::*;

<% schema.exports.forEach(ex => { -%>
<% if (hasComment(ex)) { -%>
// <%- formatCommentBlock(ex.description, "// ") %>
<% } -%>
pub(crate) fn <%= camelToSnakeCase(ex.name) %>(<%if (ex.input) { %>_input: <%- toRustType(ex.input) %> <% } %>) -> Result<<%if (ex.output) { %> <%- toRustType(ex.output) %> <% } else { %> () <% } %>, Error> {
<% if (featureFlags['stub-with-code-samples'] && codeSamples(ex, 'rust').length > 0) { -%>
<%- codeSamples(ex, 'rust')[0].source %>
Expand Down

0 comments on commit f6a5d26

Please sign in to comment.