Skip to content

Instantly share code, notes, and snippets.

View aviau's full-sized avatar

Alexandre Viau aviau

View GitHub Profile

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have

@sampsyo
sampsyo / multijson.py
Created April 14, 2011 18:59
quick & dirty reading/writing of files containing multiple JSON objects
"""A couple of very simple utilities for reading and writing files
that contain multiple JSON values. Could be useful in situations where
you're generating a bunch of data for later processing and then, later,
you want to read it in an element at a time.
The json module doesn't really support streaming reads, though, so this
is limited by that. If you need real streaming, you probably want to use
something like ijson:
http://pypi.python.org/pypi/ijson/
"""