Skip to content

Commit e4a1186

Browse files
Add buffy (#58)
* added buffy * [buffy] - update doc
1 parent 3aaf8e3 commit e4a1186

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Here the list of libraries tested:
2222
| :white_check_mark: | [amazonica+s3](./amazonica-s3) | Cloud API wrapper library | |
2323
| :white_check_mark: | [asami](./asami) | Asami DB | |
2424
| :white_check_mark: | [aws-api+s3](./aws-api-s3) | Cognitect AWS client library | |
25+
| :white_check_mark: | [buffy](./buffy) | Buffy, The Byte Buffer Slayer | |
2526
| :white_check_mark: | [carmine](./carmine) | Redis client and message queue for Clojure | |
2627
| :white_check_mark: | [cheshire](./cheshire) | JSON parser/writer | |
2728
| :white_check_mark: | [cli4clj](./cli4clj) | Interactive Command Line Interfaces (CLIs) for Clojure Applications | |

buffy/.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/target
2+
/classes
3+
/checkouts
4+
profiles.clj
5+
pom.xml
6+
pom.xml.asc
7+
*.jar
8+
*.class
9+
/.lein-*
10+
/.nrepl-port
11+
/.prepl-port
12+
.hgignore
13+
.hg/
14+
.clj-kondo
15+
.cache
16+
.nrepl-port
17+
output.calva-repl

buffy/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# buffy
2+
3+
Testing whether [clojurewerkz/buffy](https://github.com/clojurewerkz/buffy)
4+
library can be used in a native binary.
5+
6+
## Usage
7+
8+
Currently testing:
9+
```clojure
10+
[clojurewerkz/buffy "1.1.0"]
11+
```
12+
13+
Test with:
14+
```bash
15+
lein do clean, uberjar, native, run-native
16+
```

buffy/project.clj

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(defproject buffy "0.1.0-SNAPSHOT"
2+
:description "FIXME: write description"
3+
:url "http://example.com/FIXME"
4+
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
5+
:url "https://www.eclipse.org/legal/epl-2.0/"}
6+
:dependencies [[org.clojure/clojure "1.10.3"]
7+
[clojurewerkz/buffy "1.1.0"]]
8+
:main buffy.core
9+
:profiles {:uberjar {:aot :all}
10+
:dev {:plugins [[lein-shell "0.5.0"]]}}
11+
12+
:aliases
13+
{"native"
14+
["shell"
15+
"native-image" "--report-unsupported-elements-at-runtime"
16+
"--initialize-at-build-time" "--no-server"
17+
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
18+
"-H:Name=./target/${:name}"]
19+
20+
"run-native" ["shell" "./target/${:name}"]})

buffy/src/buffy/core.clj

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
(ns buffy.core
2+
(:require [clojurewerkz.buffy.core :as bf])
3+
(:gen-class))
4+
5+
6+
7+
(defn -main
8+
[& args]
9+
(let [s (bf/spec
10+
:hello (bf/string-type 13)
11+
:the-answer (bf/int32-type))
12+
buf (bf/compose-buffer s)]
13+
(bf/set-field buf :hello "Hello GraalVM")
14+
(prn (bf/get-field buf :hello))
15+
16+
(bf/set-field buf :the-answer 42)
17+
(prn (bf/get-field buf :the-answer))))

0 commit comments

Comments
 (0)