pub struct BladeEngine {
pub templates: HashMap<String, String>,
pub plugin_manager: Arc<LuminaPluginManager>,
pub wasm_filters: HashMap<String, (String, String)>,
}Expand description
BladeEngine — Pure Native Laravel Blade Templating Engine for Rust. Sangat cepat, tanpa alokasi berat, mendukung layout inheritance, loop variables, conditional directives, integrasi Indonesian Script, serta Filter & Ekstensi WASM Sandbox.
Fields§
§templates: HashMap<String, String>§plugin_manager: Arc<LuminaPluginManager>§wasm_filters: HashMap<String, (String, String)>Implementations§
Source§impl BladeEngine
impl BladeEngine
Sourcepub fn empty() -> BladeEngine
pub fn empty() -> BladeEngine
Membuat BladeEngine kosong (tanpa membaca views path, cocok untuk test/memory engine)
pub fn new() -> BladeEngine
Sourcepub fn with_plugin_manager(
self,
manager: Arc<LuminaPluginManager>,
) -> BladeEngine
pub fn with_plugin_manager( self, manager: Arc<LuminaPluginManager>, ) -> BladeEngine
Pasang plugin_manager kustom/global (misal dari AppState)
Sourcepub fn register_plugin(&self, plugin: WasmPlugin)
pub fn register_plugin(&self, plugin: WasmPlugin)
Daftarkan plugin WASM ke dalam sandbox engine
Sourcepub fn register_wasm_filter(
&mut self,
alias: &str,
plugin_name: &str,
func_name: &str,
)
pub fn register_wasm_filter( &mut self, alias: &str, plugin_name: &str, func_name: &str, )
Daftarkan alias filter Blade kustom yang mengarah ke plugin WASM tertentu
Sourcepub fn register_is_script(&self, name: &str, runner: IsScriptRunner)
pub fn register_is_script(&self, name: &str, runner: IsScriptRunner)
Daftarkan skrip Indonesian Script (.is) ke dalam runner engine
pub fn reload_templates(&mut self, views_path: &str)
Sourcepub fn render(&self, template_name: &str, context: &BladeContext) -> String
pub fn render(&self, template_name: &str, context: &BladeContext) -> String
Render template menggunakan nama file atau format dot-notation (misal: “auth.login” atau “layouts/app.blade.rs”)
Sourcepub fn render_string(&self, content: &str, context: &BladeContext) -> String
pub fn render_string(&self, content: &str, context: &BladeContext) -> String
Render string template secara langsung tanpa membaca file
Sourcepub fn eval_expr_with_filters(
&self,
expr: &str,
context: &BladeContext,
) -> String
pub fn eval_expr_with_filters( &self, expr: &str, context: &BladeContext, ) -> String
Evaluasi ekspresi variabel atau literal yang mungkin memiliki filter berantai:
Contoh: $nominal | rupiah
Contoh: $title | slug | uppercase
Contoh: $content | limit: 100
Contoh: $comment | sensor_kata (WASM Sandbox)
Sourcepub fn format_rupiah(input: &str) -> String
pub fn format_rupiah(input: &str) -> String
Helper Native: Format angka ke format mata uang Rupiah
Sourcepub fn slug(input: &str) -> String
pub fn slug(input: &str) -> String
Helper Native: Mengubah teks menjadi slug URL (contoh: “Halo Dunia!” -> “halo-dunia”)
Sourcepub fn production_shield_html() -> &'static str
pub fn production_shield_html() -> &'static str
HTML, CSS, dan JavaScript untuk proteksi template di browser (Anti-DevTools, Anti-Inspect, Anti-Copy)
Sourcepub fn minify_html(input: &str) -> String
pub fn minify_html(input: &str) -> String
Helper minifikasi dokumen HTML (menghilangkan baris kosong dan memadatkan whitespace)
Trait Implementations§
Source§impl Default for BladeEngine
impl Default for BladeEngine
Source§fn default() -> BladeEngine
fn default() -> BladeEngine
Auto Trait Implementations§
impl Forget for BladeEngine
impl Freeze for BladeEngine
impl Move for BladeEngine
impl RefUnwindSafe for BladeEngine
impl Send for BladeEngine
impl Sync for BladeEngine
impl Unpin for BladeEngine
impl UnsafeUnpin for BladeEngine
impl UnwindSafe for BladeEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().