oid

Crates.iooid
lib.rsoid
version0.3.0
created_at2019-07-24 06:31:42.76425+00
updated_at2025-12-09 20:10:34.156135+00
descriptionRust-native library for building, parsing, and formating Object Identifiers (OIDs)
homepage
repositoryhttps://github.com/sbruton/oid-rs
max_upload_size
id151276
size54,259
Sean Bruton (sbruton)

documentation

README

Object Identifier Library for Rust

Crate API Minimum rustc version

Object Identifiers are a standard of the ITU used to reference objects, things, and concepts in a globally unique way. This crate provides for data structures and methods to build, parse, and format OIDs.

Basic Utilization

Running Example

You can run the example code from examples/basic.rs using cargo:

cargo run --example basic

Parsing OID String Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from("0.1.2.3")?;

Parsing OID Binary Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?;

Encoding OID as String Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from("0.1.2.3")?;
let oid: String = oid.into();
assert_eq!(oid, "0.1.2.3");

Encoding OID as Binary Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?;
let oid: Vec<u8> = oid.into();
assert_eq!(oid, "0.1.2.3");

Adding as a dependency with cargo-edit

cargo add oid

Adding as a dependency with cargo-edit for a !#[no_std] crate

cargo add oid --no-default-features

Adding as a dependency directly to Cargo.toml

[dependencies]
oid = "0.3"

Adding as a dependency directly to Cargo.toml for a !#[no_std] crate

[dependencies]
oid = { version = "0.3", default-features = false }

Building

The build routines have been automated with cargo-make. If you're not using cargo-make, you can check [Makefile.toml] for the relevant manual build procedures.

Building for a platform with Rust Standard Library

cargo make

Building for an embedded platform or #![no_std]

cargo make build_no_std

Fuzzing Inputs

Profiles for cargo-fuzz are included for fuzzing the inputs on public method parameters.

Fuzz Binary OID Parsing

cargo make fuzz_parse_binary

Fuzz String OID Parsing

cargo make fuzz_parse_string

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this library by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 0

cargo fmt