//! Sailfish is a simple, small, and extremely fast template engine for Rust. //! Before reading this reference, //! I recommend reading [User guide](https://rust-sailfish.github.io/sailfish/). //! //! This crate contains utilities for rendering sailfish template. //! If you want to use sailfish templates, import `sailfish-macros` crate and use //! derive macro `#[derive(RenderOnce)]` or `#[derive(Render)]`. //! //! In most cases you don't need to care about the `runtime` module in this crate, but //! if you want to render custom data inside templates, you must implement //! [`Render`] or [`RenderOnce`] for that type. //! //! ```ignore //! use sailfish::RenderOnce; //! //! #[derive(RenderOnce)] //! #[template(path = "hello.stpl")] //! struct HelloTemplate { //! messages: Vec //! } //! //! fn main() { //! let ctx = HelloTemplate { //! messages: vec!["foo".to_string(), "bar".to_string()] //! }; //! //! println!("{}", ctx.render_once().unwrap()); //! } //! ``` #![doc( html_logo_url = "https://raw.githubusercontent.com/rust-sailfish/sailfish/master/resources/icon.png" )] #![cfg_attr(sailfish_nightly, feature(core_intrinsics))] #![cfg_attr(docsrs, feature(doc_cfg))] #![feature(const_trait_impl)] #![feature(effects)] #![feature(maybe_uninit_slice)] #![feature(specialization)] #![allow(clippy::redundant_closure)] #![deny(missing_docs)] #[macro_use] mod utils; mod buffer; pub mod escape; pub mod filter; mod html_escape; mod render; #[doc(hidden)] pub mod runtime; mod size_hint; pub use buffer::Buffer; pub use escape::{Escape, EscapeJsonString}; pub use html_escape::EscapeHtml; pub use render::{ default_render_escaped, default_render_once_escaped, Render, RenderError, RenderOnce, RenderResult, }; pub use size_hint::SizeHint; #[cfg(feature = "derive")] #[cfg_attr(docsrs, doc(cfg(feature = "derive")))] pub use sailfish_macros::{Render, RenderOnce};