#urbit #formatting #parser #data #type #name #patp-patq

urbit-ob

Utilities for formatting and parsing Urbit's @p and @q data types (patp/patq)

2 unstable releases

0.2.0 Nov 4, 2023
0.1.0 Nov 3, 2023

#4 in #urbit

Download history 42/week @ 2024-07-24 41/week @ 2024-07-31 63/week @ 2024-08-07 225/week @ 2024-08-14 47/week @ 2024-08-21 110/week @ 2024-08-28 294/week @ 2024-09-04 255/week @ 2024-09-11 294/week @ 2024-09-18 449/week @ 2024-09-25 235/week @ 2024-10-02 443/week @ 2024-10-09 423/week @ 2024-10-16 514/week @ 2024-10-23 522/week @ 2024-10-30 361/week @ 2024-11-06

1,924 downloads per month

MIT license

34KB
788 lines

urbit-ob

crate docs

Utilities for formatting and parsing Urbit's @p and @q data types (patp/patq).

Example

Generate all the planet names for a given star:

use urbit_ob::*;

fn all_planets(star: u16) -> Vec<String> {
    let star_val: u32 = star as u32;
    let mut p_names: Vec<String> = Vec::with_capacity(0xffff);
    for value in 0x0001..=0xffff {
        let p_val: u32 = (value << 16) | star_val;
        let p_name = patp(p_val);
        p_names.push(p_name);
    }
    p_names
}

fn main() {
    let star_val: u16 = patp2int("~rondev").unwrap();
    println!("{:?}", all_planets(star_val).first().unwrap())
}

See the Documentation for all features.


lib.rs:

Utilities for formatting and parsing Urbit's @p and @q data types (patp/patq).

Dependencies

~0.8–1.4MB
~30K SLoC