-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wasm32-wasip1-threads: shared-memory disallowed due to not compil…
…ed with 'atomics' or 'bulk-memory' features (#1221)
- Loading branch information
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "wasm32-wasip1-threads-test" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
rusqlite = { version = "0.32.0", features = ["bundled"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use rusqlite::{Connection, Result}; | ||
|
||
#[derive(Debug)] | ||
struct Person { | ||
pub id: i32, | ||
pub name: String, | ||
pub data: Option<Vec<u8>>, | ||
} | ||
|
||
fn main() -> Result<()> { | ||
let conn = Connection::open_in_memory()?; | ||
|
||
conn.execute( | ||
"CREATE TABLE person ( | ||
id INTEGER PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
data BLOB | ||
)", | ||
(), // empty list of parameters. | ||
)?; | ||
let me = Person { | ||
id: 0, | ||
name: "Steven".to_string(), | ||
data: None, | ||
}; | ||
conn.execute( | ||
"INSERT INTO person (name, data) VALUES (?1, ?2)", | ||
(&me.name, &me.data), | ||
)?; | ||
|
||
let mut stmt = conn.prepare("SELECT id, name, data FROM person")?; | ||
let person_iter = stmt.query_map([], |row| { | ||
Ok(Person { | ||
id: row.get(0)?, | ||
name: row.get(1)?, | ||
data: row.get(2)?, | ||
}) | ||
})?; | ||
|
||
for person in person_iter { | ||
println!("Found person {:?}", person.unwrap()); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters