Skip to content

Commit

Permalink
Merge branch 'latest' into docs_4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Feb 17, 2021
2 parents a63d8e9 + 6f2664e commit a44acf4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ jobs:
args: --force cargo-wasi
- name: Build code with cargo-wasi
uses: actions-rs/cargo@v1
continue-on-error: true ## TODO: remove this when build works...
with:
command: wasi
args: build
Expand Down
15 changes: 15 additions & 0 deletions nix/rust.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# nix/rust.nix
{ sources ? import ./sources.nix }:
let
pkgs =
import sources.nixpkgs { overlays = [ (import sources.rust-overlay) ]; };
rustVersion = pkgs.rust-bin.stable.latest.rust.override {
#extensions = [ "rust-src" ];
#targets = [ "x86_64-unknown-linux-musl" ];
targets = [ "wasm32-wasi" "wasm32-unknown-unknown" ];
};
in
pkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
}
18 changes: 9 additions & 9 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "3cd7914b2c4cff48927e11c216dadfab7d903fe5",
"sha256": "1agq4nvbhrylf2s77kb4xhh9k7xcwdwggq764k4jgsbs70py8cw3",
"rev": "af958e8057f345ee1aca714c1247ef3ba1c15f5e",
"sha256": "1qjavxabbrsh73yck5dcq8jggvh3r2jkbr6b5nlz5d9yrqm9255n",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/3cd7914b2c4cff48927e11c216dadfab7d903fe5.tar.gz",
"url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
Expand All @@ -17,10 +17,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d1f97a5eb5115289071d8449f26e7b92ce6b6709",
"sha256": "098rb747w4p5lxz74bj738bpjd4xjn0ahssjp9n8237dmmx3wg5p",
"rev": "5852a21819542e6809f68ba5a798600e69874e76",
"sha256": "05vqlnafz287wamy2a3kp6h32mmha1ahq8gzp7slihdci2ibcdx6",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/d1f97a5eb5115289071d8449f26e7b92ce6b6709.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/5852a21819542e6809f68ba5a798600e69874e76.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"rust-overlay": {
Expand All @@ -29,10 +29,10 @@
"homepage": null,
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "0bb9ef6d8b34e5579d7384201f3106a49ce3deca",
"sha256": "09cva1r53x1ihyzbssdscx4n5913pra8f006q095ww9wvfvz8bxf",
"rev": "62d46e74e18babdb1d2b3994dbb91d5fa4672597",
"sha256": "0v7bfn0m0g4yywzxxa8ygll41mb8506kvkfbywdx0g7r6ddvcndr",
"type": "tarball",
"url": "https://github.com/oxalica/rust-overlay/archive/0bb9ef6d8b34e5579d7384201f3106a49ce3deca.tar.gz",
"url": "https://github.com/oxalica/rust-overlay/archive/62d46e74e18babdb1d2b3994dbb91d5fa4672597.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
5 changes: 4 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
let
sources = import ./nix/sources.nix;
rustPlatform = import ./nix/rust.nix { inherit sources; };
pkgs = import sources.nixpkgs { overlays = [ (import sources.rust-overlay) ]; };
in
with pkgs;

pkgs.mkShell {
buildInputs = [
rust-bin.stable.latest.rust
rustPlatform.rust.cargo
git
stdenv.cc.cc.lib
(python38.withPackages(ps: with ps; [ virtualenv tox setuptools ]))
(python39.withPackages(ps: with ps; [ virtualenv setuptools ]))
(python37.withPackages(ps: with ps; [ virtualenv setuptools ]))
wasmtime
wasm-pack
];

shellHook = ''
Expand Down
8 changes: 2 additions & 6 deletions src/core/src/ffi/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,8 @@ ffi_fn! {
unsafe fn signature_first_mh(ptr: *const SourmashSignature) -> Result<*mut SourmashKmerMinHash> {
let sig = SourmashSignature::as_rust(ptr);

if let Some(item) = sig.signatures.get(0) {
if let Sketch::MinHash(mh) = item {
Ok(SourmashKmerMinHash::from_rust(mh.clone()))
} else {
unimplemented!()
}
if let Some(Sketch::MinHash(mh)) = sig.signatures.get(0) {
Ok(SourmashKmerMinHash::from_rust(mh.clone()))
} else {
// TODO: need to select the correct one
unimplemented!()
Expand Down
1 change: 1 addition & 0 deletions src/core/src/ffi/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ thread_local! {
pub static LAST_ERROR: RefCell<Option<Error>> = RefCell::new(None);
}

#[allow(clippy::clippy::wrong_self_convention)]
pub trait ForeignObject: Sized {
type RustObject;

Expand Down

0 comments on commit a44acf4

Please sign in to comment.