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

Update to Spin SDK 3.x #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

itowlson
Copy link

It was previously on 0.4 which was causing downstream projects some ructions! If there's a better way to manage the new async send then please go ahead, I just didn't know how to handle it in that macro!

(And I haven't been able to test, I'm afraid, because no Twitter.)

Signed-off-by: itowlson <[email protected]>
@itowlson
Copy link
Author

Oops. Converting to draft because there are some other conflicts too.

@itowlson itowlson marked this pull request as draft December 18, 2024 20:12
@itowlson itowlson marked this pull request as ready for review December 18, 2024 20:17
@itowlson
Copy link
Author

No there aren't, I'm just an idiot. Ready to review after all!

@rajatjindal
Copy link
Owner

Hi @itowlson, were you able to test this? If so I am happy to just merge it.

@itowlson
Copy link
Author

@rajatjindal I don't actually know how to test it. I tried a naive variation of the basic example but mine failed with an enigmatic parse error. If you have an example of using it then I can give it a go.

What I tried:

use handlebars::Handlebars;
use handlebars_sprig;

fn main() {
    // Get a handlebars instance
    let mut hbs = Handlebars::new();

    // THE IMPORTANT PART: Add the helpers
    handlebars_sprig::addhelpers(&mut hbs);

    // From this point, you can do whatever you want to do with the
    // handlebars instance. It will have all of the functions available
    // to the templates.
    let tpl = "{{ tweet fermyontech 1868691973097562174 }}";

    // Example of running a template render.
    let empty_context: Vec<String> = vec![];
    println!(
        "Template produced: {}",
        hbs.render_template(tpl, &empty_context).unwrap()
    )
}

Result:

thread 'main' panicked at src/main.rs:20:50:
called `Result::unwrap()` on an `Err` value: RenderError { desc: "Cannot access array/vector with string index.", template_name: None, line_no: Some(1), column_no: Some(1), cause: Some(ParseIntError { kind: InvalidDigit }), unimplemented: false }

(line 20 is the render_template call)

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

Successfully merging this pull request may close these issues.

2 participants