Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

sailfish

> 编程语言
Open source

Simple, small, and extremely fast template engine for Rust

987 stars0 likes1 views
WebsiteGitHub

About

Simple, small, and extremely fast template engine for Rust

✨ Features

  • Simple and intuitive syntax inspired by EJS
  • Include another template file inside template
  • Built-in filters
  • Minimal dependencies ( Template file (templates/hello.stpl):
erb

  
    
      

Code:

```rust
use sailfish::TemplateSimple;

#[derive(TemplateSimple)]
#[template(path = "hello.stpl")]
struct HelloTemplate {
    messages: Vec
}

fn main() {
    let ctx = HelloTemplate {
        messages: vec![String::from("foo"), String::from("bar")],
    };
    println!("{}", ctx.render_once().unwrap());
}

Or use the more powerful Template/TemplateMut/TemplateOnce:

Template file (templates/hello.stpl):

erb

  
    
      

Code:

```rust
use sailfish::Template;

#[derive(Template)]
#[template(path = "hello.stpl")]
struct HelloTemplate {
    messages: Vec
}

impl HelloTemplate {
    fn say_hello(&self) -> String {
        String::from("Hello!")
    }
}

fn main() {
    let ctx = HelloTemplate {
        messages: vec![String::from("foo"), String::from("bar")],
    };
    println!("{}", ctx.render().unwrap());
}

You can find more examples in examples directory.

Roadmap

  • Template trait (RFC)
  • Template inheritance (block, partials, etc.)

Author

Ryohei Machida

  • GitHub: @Kogia-sima

Contributing

Contributions, issues and feature requests are welcome!

Since sailfish is an immature library, there are many planned features that is on a stage of RFC. Please leave a comment if you have an idea about its design!

Also I welcome any pull requests to improve sailfish! Find issues with Status: PR Welcome label, and let's create a new pull request!

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2020 Ryohei Machida.

This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

Documentation Deployment Instructions

bash
sudo apt install mkdocs mkdocs-material
cd sailfish_root_folder &&
cd docs && cd en 
mkdocs build

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustrusttemplate-engine

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言