Skip to content

Commit

Permalink
Make docs consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
alajpie committed Jun 16, 2020
1 parent 9f323ca commit d98b782
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "urbit-q"
version = "0.2.0"
version = "0.2.1"
authors = ["k2l8m11n2"]
edition = "2018"
description = "Encode and decode data in Urbit's @q format"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
[![](https://travis-ci.org/k2l8m11n2/urbit-q.svg?branch=master)](https://travis-ci.org/github/k2l8m11n2/urbit-q)


Based on [urbit-ob](https://github.com/urbit/urbit-ob), supports only the `@q` format.
Based on [urbit-ob](https://github.com/urbit/urbit-ob), supports only the `@q`
format.

## usage

Note that when encoding more than one byte, `encode` pads from the beginning to
an even number (as per the original implementation) and `decode` ignores any
dashes or spaces within the string.
an even number of bytes (as per the original implementation) and `decode`
ignores any dashes or spaces within the string.
```rust
urbit_q::encode(&[1]); // nec
let string = urbit_q::encode(&[1, 2, 3]); // doznec-binwes
Expand Down
18 changes: 10 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! # urbit-q
//!
//! Based on [urbit-ob](https://github.com/urbit/urbit-ob), supports only the `@q` format.
//! Based on [urbit-ob](https://github.com/urbit/urbit-ob), supports only the
//! `@q` format.
//!
//! ## usage
//!
//! Note that when encoding more than one byte, `encode` pads from the beginning to
//! an even number (as per the original implementation) and `decode` ignores any
//! dashes or spaces within the string.
//! Note that when encoding more than one byte, `encode` pads from the beginning
//! to an even number of bytes (as per the original implementation) and `decode`
//! ignores any dashes or spaces within the string.
//! ```rust
//! urbit_q::encode(&[1]); // nec
//! let string = urbit_q::encode(&[1, 2, 3]); // doznec-binwes
Expand All @@ -20,12 +21,13 @@ mod consts;

/// Encodes data to Urbit's `@q` format
///
/// Note that it pads the beginning to an even number of bytes (as per the
/// original implementation, [urbit-ob](https://github.com/urbit/urbit-ob)), e.g.
/// Note that when encoding more than one byte, it pads from the beginning to
/// an even number of bytes (as per the original implementation,
/// [urbit-ob](https://github.com/urbit/urbit-ob)), e.g.
/// ```
/// # use urbit_q::*;
/// let bytes: [u8; 3] = [1, 2, 3];
/// let string = encode(&bytes); // doznec-binwes
/// encode(&[1]); // nec
/// let string = encode(&[1, 2, 3]); // doznec-binwes
/// decode(&string).unwrap(); // [0, 1, 2, 3]
/// ```
pub fn encode(input: &[u8]) -> String {
Expand Down

0 comments on commit d98b782

Please sign in to comment.