Giter VIP home page Giter VIP logo

message-format.rs's Introduction

message-format

Build Status

This library provides message formatting services.

It supports the ICU MessageFormat syntax.

In the future, we hope to support other syntaxes as well.

Dual licensed under the MIT and Apache 2 licenses.

Documentation

The API is fully documented with examples: https://endoli.github.io/message-format.rs/

Installation

This crate works with Cargo and is on crates.io. Add it to your Cargo.toml like so:

[dependencies]
message-format = "0.0.1"

Status of Implementation

Things are under active development. This project is not quite usable yet as some of the basic functionality is being written.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

message-format.rs's People

Contributors

micrypt avatar waywardmonkeys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

message-format.rs's Issues

Create unified Traits that can be used for any formatting library

Hello, I am the author of the strfmt library.

I would like to push the stdlib to implement fmt::Formatter as a trait instead of a struct so that libraries like ours can use (and build off of) a common API, as well as format any object which implements the fmt::Display trait.

This issue is to bring this to your attention and try to work together on it.

vitiral/strfmt#11

Creating Args from owned values slice

Hi,
I have a (for simplicity) &[(String, String)], where first String corresponds to Args::name and the second String corresponds to Args::Value (of type Value::Str). How do I convert this to the Args struct? I can't get around the pub prev: Option<&'a Args<'a>> reference hell in the Args struct.

That is, I need to implement

fn to_args(args: &[(String, String)]) -> Args {
  unimplemented!()
}

Any idea? Thank you.

Edit: It does not need to actually be a function. I'll use the resulting args to format the message immediately, so if there's a way to produce the Args inline, I'd be happy with that as well.

Populating arguments

I'm not happy at all with how arguments work right now. Something clearly better is needed.

I've had some discussion about this in email with @jan-hudec

It may also be possible to do something fun with macros.

Accessing args for a parsed ICU string

I am writing a wrapper for string formatting, so that a string like There are {foo} apples. with an identifier some_string can be accessed like so in Rust:

pub fn some_string(foo: &str) -> String {
    ...
}

Right now it does not seem possible to access Args from anywhere because they are not attached to any struct but generated on the fly by a macro.

What is the suggested course of action for getting access to the Args at the moment? I don't mind if it's a bit round-about, as it will only be used from a build.rs script. Thanks!

Remove HashMaps

The use of HashMap isn't necessary as the number of items in these will usually be quite low, so we can just use a Vec of entries instead and do a quick linear search.

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.