Code Monkey home page Code Monkey logo

shinyid-rs's Introduction

ShinyID

Crates.io Docs.rs

About

ShinyID is a high-performance Rust package inspired by the Instagram shortcode system. It allows you to encode and decode unique identifiers (IDs) into a human-readable and URL-safe string format called 'shiny'. This package is designed for scenarios where speed and efficiency are crucial, making it ideal for applications that need to handle large volumes of encoded IDs.

Table of Contents

Features

  • Efficient Encoding : ShinyID offers a highly efficient method for converting numeric IDs into shiny strings.
  • Lightning-Fast Decoding : Decoding shiny strings into their original numeric IDs is optimized for speed and performance.
  • URL-Safe : Shiny strings are designed to be URL-safe, making them suitable for web applications.
  • Inspired by Instagram : The package draws inspiration from Instagram's shortcode system, ensuring a familiar and intuitive approach to representing IDs.

Installation

Add the following line to your Cargo.toml file:

[dependencies]
shinyid = "0.2.0"

Example

Here's a simple example showcasing the use of ShinyID:

use shinyid::{to_id, to_shiny};
fn main() {
    let id = 18446744073709551615;
    let shiny = to_shiny(id);
    println!("Shiny representation of {} is {}", id, shiny);

    let shiny = "P__________";
    match to_id(shiny) {
        Ok(id) => println!("ID corresponding to {} is {}", shiny, id),
        Err(err) => eprintln!("Error: {}", err),
    }
}

License

This package is distributed under the Apache License, Version 2.0. See the LICENSE file for more details.

Author

ShinyID was created by itpey.

shinyid-rs's People

Contributors

itpey avatar

Watchers

 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.