Skip to content

Commit

Permalink
0.0.2: swamp to marsh
Browse files Browse the repository at this point in the history
  • Loading branch information
disruptek committed Jun 2, 2020
1 parent b7a331a commit 18ce5be
Show file tree
Hide file tree
Showing 10 changed files with 496 additions and 1,130 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
# marsh
marshal native Nim objects via streams
_experimental_ marshalling of native Nim objects via streams, channels

- `cpp +/ nim-1.0` [![Build Status](https://travis-ci.org/disruptek/marsh.svg?branch=master)](https://travis-ci.org/disruptek/marsh)
- `arc +/ cpp +/ nim-1.3` [![Build Status](https://travis-ci.org/disruptek/marsh.svg?branch=devel)](https://travis-ci.org/disruptek/marsh)

## Goals

Making some assumptions (ie. that our types aren't changing) allows...

- predictably fast performance
- predictably mild memory behavior
- predictably _idiomatic_ API
- **hard to misuse**

Crude though it may be, this code reads and writes >500mb of arbitrary Nim data
structures in 1.5s on my machine.

## Example

It currently looks like this:

```nim
import marsh
var
data = someArbitraryDataFactory()
handle = openFileStream("somefile", fmWrite)
writeThing(handle, data)
close handle
```

and then

```nim
import marsh
var
data: SomeArbitraryType
handle: openFileStream("somefile", fmRead)
readThing(handle, data)
close handle
```

Zevv gave me the idea to provide a `channels` API as well, so that's something
to add next. Channels are kinda expensive by comparison, though, because they
require a copy...

## Installation

```
Expand All @@ -22,6 +58,8 @@ $ nimble install https://github.com/disruptek/marsh

## Documentation

_WIP_

I'm going to try a little harder with these docs by using `runnableExamples`
so the documentation demonstrates _current_ usage examples and working tests
despite the rapidly-evolving API.
Expand Down
205 changes: 64 additions & 141 deletions docs/marsh.html

Large diffs are not rendered by default.

25 changes: 7 additions & 18 deletions docs/marsh.idx
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
writeThing marsh.html#writeThing,Stream, marsh: writeThing[T](s`gensym25076855: Stream; o`gensym25076856: SinglyLinkedList[T])
readThing marsh.html#readThing,Stream, marsh: readThing[T](s`gensym25076859: Stream;\n o`gensym25076860: var SinglyLinkedList[T])
writeThing marsh.html#writeThing,Stream,_2 marsh: writeThing[T](s`gensym25080228: Stream; o`gensym25080229: DoublyLinkedList[T])
readThing marsh.html#readThing,Stream,_2 marsh: readThing[T](s`gensym25080232: Stream;\n o`gensym25080233: var DoublyLinkedList[T])
writeThing marsh.html#writeThing,Stream,_3 marsh: writeThing[T](s`gensym25085228: Stream; o`gensym25085229: SinglyLinkedRing[T])
readThing marsh.html#readThing,Stream,_3 marsh: readThing[T](s`gensym25085232: Stream;\n o`gensym25085233: var SinglyLinkedRing[T])
writeThing marsh.html#writeThing,Stream,_4 marsh: writeThing[T](s`gensym25090228: Stream; o`gensym25090229: DoublyLinkedRing[T])
readThing marsh.html#readThing,Stream,_4 marsh: readThing[T](s`gensym25090232: Stream;\n o`gensym25090233: var DoublyLinkedRing[T])
writeThing marsh.html#writeThing,Stream,string marsh: writeThing(s: Stream; o: string)
readThing marsh.html#readThing,Stream,string marsh: readThing(s: Stream; o: var string)
writeObject marsh.html#writeObject,Stream,T marsh: writeObject[T](s: Stream; o: T)
readObject marsh.html#readObject,Stream,T marsh: readObject[T](s: Stream; o: var T)
writeThing marsh.html#writeThing,Stream,T marsh: writeThing[T](s: Stream; o: T)
readThing marsh.html#readThing,Stream,T marsh: readThing[T](s: Stream; o: var T)
writeThing marsh.html#writeThing,Stream,ref.T marsh: writeThing[T](s: Stream; o: ref T)
readThing marsh.html#readThing,Stream,ref.T marsh: readThing[T](s: Stream; o: var ref T)
writeThing marsh.html#writeThing,Stream,seq[T] marsh: writeThing[T](s: Stream; o: seq[T])
readThing marsh.html#readThing,Stream,seq[T] marsh: readThing[T](s: Stream; o: var seq[T])
magic marsh.html#magic marsh: magic
greatenIndent marsh.html#greatenIndent.t,Serializer,untyped marsh: greatenIndent(s: var Serializer; body: untyped): untyped
debung marsh.html#debung.t,Serializer,string marsh: debung(s: Serializer; msg: string): untyped
writeThing marsh.html#writeThing,Stream,T marsh: writeThing[T](stream: Stream; o: T)
readThing marsh.html#readThing,Stream,T marsh: readThing[T](stream: Stream; o: var T)
writeThing marsh.html#writeThing,string,T marsh: writeThing[T](str: var string; o: T)
readThing marsh.html#readThing,string,T marsh: readThing[T](str: string; o: var T)
236 changes: 0 additions & 236 deletions docs/swamp.html

This file was deleted.

7 changes: 0 additions & 7 deletions docs/swamp.idx

This file was deleted.

Loading

0 comments on commit 18ce5be

Please sign in to comment.