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

expected ident at line 1 column 2 #300

Closed
linonetwo opened this issue Mar 29, 2023 · 3 comments
Closed

expected ident at line 1 column 2 #300

linonetwo opened this issue Mar 29, 2023 · 3 comments

Comments

@linonetwo
Copy link

Don't know what this error message talk about

Plugin:

#[plugin_fn]
// see https://docs.rs/extism-pdk/latest/extism_pdk/struct.HttpRequest.html for docs on this type
pub fn http_get(Json(req): Json<HttpRequest>) -> FnResult<()> {
  info!("Request to: {}", req.url);
  // let mut headers = BTreeMap::new();
  // headers.insert("User-Agent".to_owned(), "my-http-client/1.0".to_owned());
  // let request = HttpRequest::new(String::from("https://bing.com"));
  // let res = http::request::<()>(&request, None)?;
  // Ok(res)
  Ok(())
}

Run

cargo build --release --target wasm32-unknown-unknown && extism call target/wasm32-unknown-unknown/release/memelooop_plugin_openai.wasm http_get --input "this is a test"
@linonetwo
Copy link
Author

Oh, it is from Json(req): Json<HttpRequest>

Developing using extism makes me angry.

@nilslice
Copy link
Member

@linonetwo for your anger, I'd recommend some Rust Book therapy:

https://doc.rust-lang.org/book/

@linonetwo
Copy link
Author

linonetwo commented Mar 30, 2023

No, I'm fremillar with Rust, I've develop Affine's rust client.

Its this lib's err message and lack of example that makes bad dev experience. I post it here because this will help someone google here, and become the complement of the lacking doc.

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

2 participants