Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue running sample in README #26

Open
lbradstreet opened this issue Mar 10, 2015 · 6 comments
Open

Issue running sample in README #26

lbradstreet opened this issue Mar 10, 2015 · 6 comments

Comments

@lbradstreet
Copy link

First off, thank you for buffy, it seems like exactly what I need.

I'm having some trouble running the compose / decompose on the dynamic-type as it's described in the README.

I receive this error message:

CompilerException java.lang.IllegalArgumentException: No implementation of method: :decompose of protocol: #'clojurewerkz.buffy.core/Composable found for class: io.netty.buffer.UnpooledUnsafeDirectByteBuf, compiling:(buffy_test/core.clj:1:25)

For this minimal example extracted from the readme:
https://github.com/lbradstreet/buffy-test/blob/master/src/buffy_test/core.clj

The only thing I could think I could possibly be doing wrong is using the wrong namespaces on the functions.

If you could just point me in the right directly I'll happily to solve things myself and provide a PR for the README (if required).

Thanks again,

Lucas

@ifesdjeen
Copy link
Member

Hi Lucas,

Probably what you're looking for is this exapmle:

(ns clojurewerkz.buffy.core-test
  (:refer-clojure :exclude [read])
  (:require [clojure.test :refer :all]
            [clojurewerkz.buffy.util :refer :all]
            [clojurewerkz.buffy.core :refer :all]
            [clojurewerkz.buffy.types.protocols :refer :all]))

(deftest complete-access-test
  (let [s (spec :first-field  (int32-type)
                :second-field (string-type 10)
                :third-field  (boolean-type))
        b (compose-buffer s)]

    (compose b {:first-field 101
                :second-field "string"
                :third-field true})
    (is (= {:third-field true :second-field "string" :first-field 101}
           (decompose b)))))

Could you please point me to the place in README you've constructed your example from?.. It'd be good to improve the readme for future.

@lbradstreet
Copy link
Author

Hi @ifesdjeen
Thanks for the quick reply.

I constructed the example from the dynamic frames section:
https://github.com/clojurewerkz/buffy/blob/master/README.md#dynamic-frames

Code was from the following line:
"It's implementation is a little bit more complex, but still reasonably simple. First, we define a dynamic string frame in the same manner as we made with netstrings:"

The actual issue is that I hadn't required clojurewerkz.buffy.types.protocols
and was using read from clojure.core. clojurewerkz.buffy.types.protocols isn't mentioned in the README so it's kinda easy to go wrong.

Seems like it is the same issue discussed here:
#18

I'd be happy to submit a PR.

Thanks again

@ifesdjeen
Copy link
Member

That's true, yes...
I think that should be changed. I'll check into the details. If you'd like to work on a PR - we're always happy to accept patches!

Thanks!

@bcambel
Copy link
Contributor

bcambel commented Aug 3, 2016

@michaelklishin @ifesdjeen do you have any plans to fix the issue within the README ?

I am having the following exception while running the same code

java.lang.IllegalArgumentException: No implementation of method: :decompose of protocol: #'clojurewerkz.buffy.core/Composable found for class: io.netty.buffer.UnpooledUnsafeDirectByteBuf

@ifesdjeen
Copy link
Member

@bcambel yes, sorry, it somehow got lost in the pit of my todo list. I'll check it out over the weekend.

@bcambel
Copy link
Contributor

bcambel commented Aug 10, 2016

@ifesdjeen thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants