Skip to content

Commit 53aeaeb

Browse files
committed
feat(rust): update zerocopy to 0.8 and use IntoBytes trait
The zerocopy crate renamed AsBytes to IntoBytes in version 0.8. Updated Rust example code and documentation to use the new API. Upstream-PR: asg017#244
1 parent 83664ac commit 53aeaeb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/simple-rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
[dependencies]
66
sqlite-vec={version="0.0.1-alpha.7"}
77
rusqlite = {version="0.31.0", features=["bundled"]}
8-
zerocopy = "0.7.33"
8+
zerocopy = "0.8"
99

1010
[[bin]]
1111
name="demo"

examples/simple-rust/demo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rusqlite::{ffi::sqlite3_auto_extension, Connection, Result};
22
use sqlite_vec::sqlite3_vec_init;
3-
use zerocopy::AsBytes;
3+
use zerocopy::IntoBytes;
44

55
fn main() -> Result<()> {
66
unsafe {

site/using/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Then, you can verify your installation was successful by embedding your first ve
2929
```rs
3030
use sqlite_vec::sqlite3_vec_init;
3131
use rusqlite::{ffi::sqlite3_auto_extension, Result};
32-
use zerocopy::AsBytes;
32+
use zerocopy::IntoBytes;
3333

3434
fn main()-> Result<()> {
3535
unsafe {
@@ -56,7 +56,7 @@ for a more complete Rust demo.
5656

5757
## Working with vectors in Rust
5858

59-
If your vectors are provided as a `Vec<f32>` type, the [`zerocopy` crate](https://crates.io/crates/zerocopy) is recommended, specifically `zerocopy::AsBytes`. This will allow you to pass in vectors into `sqlite-vec` without any copying.
59+
If your vectors are provided as a `Vec<f32>` type, the [`zerocopy` crate](https://crates.io/crates/zerocopy) is recommended, specifically `zerocopy::IntoBytes`. This will allow you to pass in vectors into `sqlite-vec` without any copying.
6060

6161
```rs
6262
let query: Vec<f32> = vec![0.1, 0.2, 0.3, 0.4];

0 commit comments

Comments
 (0)