urbit-ob

Crates.iourbit-ob
lib.rsurbit-ob
version0.2.0
sourcesrc
created_at2023-11-03 09:36:58.558038
updated_at2023-11-04 06:30:24.643274
descriptionUtilities for formatting and parsing Urbit's @p and @q data types (patp/patq).
homepage
repositoryhttps://github.com/urbitme/urbit-ob-rs
max_upload_size
id1023955
size37,094
~nodreb-borrus (nodreb-borrus)

documentation

https://docs.rs/urbit-ob

README

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.

Commit count: 18

cargo fmt