Comments (3)
Apparently import scodec.codecs.implicits._
is what I needed.
from scodec.
I've had to modify the example, because Codec.decode now returns an Attempt[DecodeResult[(Int ~ Int ~ Int)]]
The whole example now looks like this:
import scodec._
import scodec.bits._
import codecs._
// Create a codec for an 8-bit unsigned int followed by an 8-bit unsigned int followed by a 16-bit unsigned int
val firstCodec = uint8 ~ uint8 ~ uint16
// Decode a bit vector using that codec
val result: Attempt[DecodeResult[(Int ~ Int ~ Int)]] = Codec.decode(BitVector(0x10, 0x2a, 0x03, 0xff))(firstCodec)
// Successful(DecodeResult(((16,42),1023),BitVector(empty)))
// Sum the result
val add3 = (_: Int) + (_: Int) + (_: Int)
val sum: DecodeResult[Int] = result.require.map(add3)
// DecodeResult(1081,BitVector(empty))
from scodec.
Thanks for pointing this out. README has been updated.
from scodec.
Related Issues (20)
- Summoner evaluates to null HOT 2
- Question: Leverage ordering in `discriminated` codec to facilitate migration HOT 2
- pbcd codec pads right instead of left. HOT 1
- Maven artifactId changed in 1.10.4 release HOT 1
- intelliJ IDEA No implicit for prameter auto HOT 1
- Padding in Base64Url encoding should be optional HOT 2
- Typecase on tuple2 is throwing ClassCastException (1.11.3, 1.10.3. Scala 2.12.8) HOT 1
- ConstrainedVariableSizeCodec sizeBound is incorrect
- SizeBound of VarLongCodec and VarIntCodec?
- Make a release with new scodec-bits HOT 4
- Consider codecs of union types
- Consider adopting shapeless-deriving HOT 2
- BitVector.reverseBitOrder unreliable on non-whole-byte BitVectors HOT 1
- Method too large HOT 2
- varlong should not throw on negative Numbers
- Cross-Compiling scala 2.13 and scala 3 against scodec-core HOT 3
- No issue - just a thank you HOT 1
- CodecSuite.roundtrip has no Equality HOT 1
- How to decode uint8 length 10 into string in C language HOT 2
- constantLenient is incorrect when streaming HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scodec.