Code Monkey home page Code Monkey logo

oid's Introduction

Object Identifier Library for Rust

All Contributors

Build Status Crate codecov API Minimum rustc version Average time to resolve an issue Percentage of issues still open

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.1.0"

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

[dependencies]
oid = { 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

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Benoît C.
Benoît C.

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

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.

oid's People

Contributors

sbruton avatar allcontributors[bot] avatar cbenoit avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.