Giter Club home page Giter Club logo

accept-language-rs's Introduction

accept-language

A tiny library for parsing the Accept-Language header from browsers (as defined here)

Usage

accept-language is intended to be used by a webserver, probably to decide which languages to serve up to the user based on their preferred language and the languages your application supports.

At it's most basic, it looks like this

extern crate accept_language;

use accept_language::{intersection, parse};

let user_languages = parse("en-US, en-GB;q=0.5");
let common_languages = intersection("en-US, en-GB;q=0.5", vec!["en-US", "de", "en-GB"]);

For more info and to view the full documentation, check them out on docs.rs.

Stability

accept-language is fuzz tested with cargo-fuzz. As of 1.2.1, these are the results of both fuzz tests for parse and intersection respectively.

parse

cargo fuzz run -O parse -- -max_total_time=60
...
Done 926619 runs in 61 second(s)

intersection

cargo fuzz run -O intersection -- -max_total_time=60
...
Done 846914 runs in 61 second(s)

Contributing

Contributions are always welcome! If you found a bug, please submit an issue. If you'd like to submit a patch or feature, feel free to submit a pull request. rustfmt should be used to have consistent code formatting throughout the project.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

accept-language-rs's People

Contributors

kornelski avatar lukaskalbertodt avatar mike-engel avatar sstangl avatar

Stargazers

 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.