botika/yarte

Yet Another Rust Template Engine

bytes-buf feature can produce SIGILL

Should we start to worry?

bytes-buf feature can produce SIGILL.

avx and sse flags are in almost all cpus of x86 and x86_64 architectures.

More details in https://github.com/botika/v_escape/issues/54.

Satan has been slaughtered and sent to heaven. Should we start to worry?

Disclaimer

All structures and functions in this crate -- even those based on the real crates -- are entirely fictional. All celebrity codes are impersonated...poorly. The following program contains coarse language and due to its content it should not be used by anyone.

Yarte

Yarte stands for Yet Another Rust Template Engine. Uses a Handlebars-like syntax, well-known and intuitive for most developers. Yarte is an optimized, and easy-to-use rust crate, with which developers can create logic around their HTML templates using conditionals, loops, rust code and template composition.

Features

  • Almost all Rust expressions are valid
  • Meta programming system with almost all Rust expressions, conditionals, loops, modules and partial recursion
  • Low level, SIMD and zero copy runtime
  • A fancy-text debug mode to visualize the code generated by Yarte
  • Emit snipped annotations at error
  • Improved daily and has full coverage (without stupid bugs that take months or years to fix)

Yarte is under development but some of its parts are stable. The derivations and proc_macro, text and html(not minified), and the json serializer are stable and with enough coverage to put into production. It is also proposed to integrate Jinja or any other template language so you can reuse your favorite templates, do not migrate them, raise an issue and I will try to give it more priority.

Is it really fast?

See it for yourself in the TechEmpower benchmarks with actix and ntex

Documentation

In order to fully understand Yarte's capabilities take a look at the following documentation:

  • Tests
  • Our book
  • Crate documentation
  • Minimum supported Rust version: 1.45 or later

Or, in nightly, just:

Acknowledgment

Yarte is based on all previous templates engines, syntax as well as its documentation is highly influenced by Handlebars. Logo adapted from Creative Commons images

Contributing

Please, contribute to Yarte! The more the better! Feel free to open an issue and/or contacting directly with the owner for any request or suggestion.

I want to move these yarte, v_escape, v_eval and buf-min to a team with me as a member. If someone wants to participate in this team, open an issue

Code of conduct

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4

License

This project is distributed under the terms of both the Apache License (Version 2.0) and the MIT license, specified in LICENSE-APACHE and LICENSE-MIT respectively.

Issues

Collection of the latest Issues

botika

botika

Comment Icon0

The idea is to separate the compilation of templates and rustc. For this purpose I want to use a tool based on typescript and wasm that offers easy compatibility with existing tools (webpack, postcss, ...). From here generate the rust code with this tool to include it later in the application. With this tool I could think of extending the language, such as vuejs or others. And other features, static sites, integration with tailwindcss or similar, optimizations, etc.

botika

botika

Comment Icon0

I want to do all the issues and ideas, make you a point of contact between Rust and the current web development to be able to absorb the largest number of developers to Rust. The idea is to create simple DSLs so that Rust's learning curve is much lower by taking advantage of the new developer's prior knowledge.

The possibilities are immense and the time is limited. I would go much faster with someone else who would like to make this idea their own.

Facilitate the writing of optimized and secure code for any developer.

botika

botika

enhancement
Comment Icon0

To solve the paths to the components and in order to modularize the logic into reusable parts.

It will be solved automatically by prefix in the name of the crate or by specifying the path or unique identifier.

They must be able to be used within the template as if it were a partial, only packetizable.

botika

botika

enhancement
Comment Icon0

We love Webpack, God save, basically integrate hot module replace and optimizations. And use webpack for make your templates, purge css, optimize, etc

Wasi has support to use the file systems and although it is in an experimental state. With the existing features, the yarte modules could be integrated into a loader or / and a plugin for the agile development of templates.

Once finished the new parsers should be the priority. The integration and extension of existing tools is the most important of the second phase of development before having a stable version.

botika

botika

enhancement
Comment Icon0

Use HIR structure for build any parser defined by user

  • Tokenize by topology of input #195 #201
  • Semi tokenize groups and some literals before parse Rust expression
  • DI on AST constructor trait making sure to respect Liscov Wrap id-arena with constructor traits with all nodes for lowering. walrus is an good example of AST based in ID using id-arena
  • Abstract adapters over inputs The only problem is to do something that can be implemented by anyone and also efficient, considering that it is the main piece launched thousands of times in development.
  • HIR from abstract adapters
  • Implement for like Handlebars
  • Implement for like Jinja
  • Implement for whatever
botika

botika

enhancement
Comment Icon0

It's easy, just do the same as in the u64 version

godofdream

godofdream

bug
Comment Icon3

I'm getting a yarte (feature=["html-min"]) error for

obviously this html comment is more than a simple html comment and should therefore work. error I'm getting: "No use html comment, use yarte comments instead"

Edit: Mentioning html-min feature

botika

botika

bug
Comment Icon0

Should reduce the use of the stack in lowering Ast. It should can to have minimum 2048 nested partials calls or/and recursions

  • Refactor AST to open close
  • Decouple partial object pool
  • Decouple constant evaluator
  • Use serde for easy coverage
botika

botika

enhancement
Comment Icon0

Isomorphic, single state and message oriented WASM application. It is designed to frame small and medium applications in modules with which to build large web portals. It works in conjunction with all of the above and its main features are simplicity, lightness and speed.

Needed

Front end

HTML5

Difference in tree

  • Tree builder
  • Tree diff
  • Update differences

Non template runtime

  • field attributes, like serde

Render

  • set_text_content, generate string with yformat! macro
  • serialize HIR to yarte language
  • Tree traversal and node finder

Handler

  • Message to function handler

Decorator pattern

  • expression attributes {{ #[attribute] expr }}

File Size

  • minimal queue implementation
  • No boilerplate in components
  • functions for no boilerplate generated code

Dispatch

  • not use virtual functions
  • no boilerplate in code

Queue runtime

  • One mut reference check

DOM management

  • #[u] Unique selectors by decorator Mark a field as unique in a collection, per example, id
  • #[f] Filter loop by decorator Mark a each argument is smaller than the collection, per example, .filter(), fold()
  • Difference by topology of the expressions in conditionals VNode has a multiple roots or equivalent cuts
  • Zip nested loops or conditionals at component Compact expressions and html node cuts
  • identifier node html attribute with build and update functions and dependencies Adapter for extend with custom Controllers.

Modules

  • Shared and incremental cache forproc_macro
  • proc_macro shared lifetime cycle
  • dispatch modularize to one match

Developers tools

  • Like redux dev tools browser extension, #133
  • Unit test framework Lifetime cycle and reference counter wrapping App
  • e2e test framework. Low priority Browser driver easy integration
  • Hot module replace, ...

Information - Updated May 01, 2022

Stars: 223
Forks: 12
Issues: 30

Repositories & Extras

maomi: A rust wasm framework for building pages with components

maomi is a MVVM-like framework for web development

maomi: A rust wasm framework for building pages with components

Rust / Wasm client web app framework

Pull requests which improve test coverage are also very welcome

Rust / Wasm client web app framework

A Rust/WASM Library to interact with Bitcoin SV

npm i bsv-wasm-bundler --save

A Rust/WASM Library to interact with Bitcoin SV

WASM / Rust / D3 example

Fetch data with Rust + WASM and show it with JS + D3

WASM / Rust / D3 example

@texhno-rust-wasm-game-of-life

A template for kick starting a Rust and WebAssembly project using Tutorial

@texhno-rust-wasm-game-of-life

rust wasm worker hello world

Built using the template at which

rust wasm worker hello world

👷‍♀️🦀🕸️ rustwasm-worker-template

A template for kick starting a Cloudflare worker project using

👷‍♀️🦀🕸️ rustwasm-worker-template

Rust WASM Web Worker Examples

This repository contains four different examples of using web workers in conjunction with WASM in

Rust WASM Web Worker Examples

rust-wasm-mandelbrot

WebAssembly でマンデルブロ集合を描きます

rust-wasm-mandelbrot
Facebook Instagram Twitter GitHub Dribbble
Privacy