Skip to content

Commit 36209ba

Browse files
committed
big bang
0 parents  commit 36209ba

File tree

6 files changed

+216
-0
lines changed

6 files changed

+216
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
/Cargo.lock

Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "grid-url"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# A GRID Url Parser
2+
3+
Features
4+
- Transforming a GRID URL into a structured representation
5+
- Resolving the domain name of the GRID url host into an ip address
6+

flake.lock

+129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4+
flake-utils.url = "github:numtide/flake-utils";
5+
rust-overlay = {
6+
url = "github:oxalica/rust-overlay";
7+
inputs = {
8+
nixpkgs.follows = "nixpkgs";
9+
flake-utils.follows = "flake-utils";
10+
};
11+
};
12+
crane = {
13+
url = "github:ipetkov/crane";
14+
inputs = {
15+
nixpkgs.follows = "nixpkgs";
16+
flake-utils.follows = "flake-utils";
17+
rust-overlay.follows = "rust-overlay";
18+
};
19+
};
20+
};
21+
outputs = { self, nixpkgs, flake-utils, rust-overlay, crane }:
22+
flake-utils.lib.eachDefaultSystem (system:
23+
let
24+
overlays = [ (import rust-overlay) ];
25+
pkgs = import nixpkgs {
26+
inherit system overlays;
27+
};
28+
29+
craneLib = crane.lib.${system};
30+
src = craneLib.cleanCargoSource ./.;
31+
32+
commonArgs = { inherit src; };
33+
34+
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
35+
bin = craneLib.buildPackage (commonArgs // {
36+
inherit cargoArtifacts;
37+
});
38+
in
39+
with pkgs;
40+
{
41+
packages = {
42+
inherit bin;
43+
default = bin;
44+
};
45+
46+
devShells.default = mkShell {
47+
buildInputs = [
48+
rust-bin.stable.latest.default
49+
rust-analyzer
50+
nil
51+
];
52+
};
53+
54+
formatter = nixpkgs-fmt;
55+
}
56+
);
57+
}

src/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pub fn add(left: usize, right: usize) -> usize {
2+
left + right
3+
}
4+
5+
#[cfg(test)]
6+
mod tests {
7+
use super::*;
8+
9+
#[test]
10+
fn it_works() {
11+
let result = add(2, 2);
12+
assert_eq!(result, 4);
13+
}
14+
}

0 commit comments

Comments
 (0)