do not use `sfrt` as an alias to sailfish::runtime

This commit is contained in:
Kogia-sima 2020-07-14 23:18:23 +09:00
parent 38de1f8051
commit 3040084ca9
3 changed files with 10 additions and 10 deletions

View File

@ -22,7 +22,7 @@ impl Parse for RenderTextMacroArgument {
fn get_rendertext_value(i: &ExprMacro) -> Option<String> {
let mut it = i.mac.path.segments.iter();
if it.next().map_or(false, |s| s.ident == "sfrt")
if it.next().map_or(false, |s| s.ident == "__sf_rt")
&& it.next().map_or(false, |s| s.ident == "render_text")
&& it.next().is_none()
{
@ -74,12 +74,12 @@ impl VisitMut for OptmizerImpl {
fl.body.stmts.remove(0);
*fl.body.stmts.last_mut().unwrap() = syn::parse2(quote! {
sfrt::render_text!(_ctx, #concat);
__sf_rt::render_text!(_ctx, #concat);
})
.unwrap();
let new_expr = syn::parse2(quote! {{
sfrt::render_text!(_ctx, #sf);
__sf_rt::render_text!(_ctx, #sf);
#fl;
unsafe { _ctx.buf.set_len(_ctx.buf.len() - #sf_len); }
}})

View File

@ -270,13 +270,13 @@ fn derive_template_impl(tokens: TokenStream) -> Result<TokenStream, syn::Error>
fn render_once_to_string(self, buf: &mut String) -> Result<(), sailfish::runtime::RenderError> {
#include_bytes_seq;
use sailfish::runtime as sfrt;
use sfrt::RenderInternal as _;
use sailfish::runtime as __sf_rt;
use __sf_rt::RenderInternal as _;
static SIZE_HINT: sfrt::SizeHint = sfrt::SizeHint::new();
static SIZE_HINT: __sf_rt::SizeHint = __sf_rt::SizeHint::new();
let mut _ctx = sfrt::Context {
buf: sfrt::Buffer::from(std::mem::take(buf))
let mut _ctx = __sf_rt::Context {
buf: __sf_rt::Buffer::from(std::mem::take(buf))
};
let _size_hint = SIZE_HINT.get();

View File

@ -106,7 +106,7 @@ impl SourceBuilder {
fn write_text<'a>(&mut self, token: &Token<'a>) {
use std::fmt::Write;
self.source.push_str("sfrt::render_text!(_ctx, ");
self.source.push_str("__sf_rt::render_text!(_ctx, ");
// write text token with Debug::fmt
write!(self.source, "{:?}", token.as_str()).unwrap();
@ -121,7 +121,7 @@ impl SourceBuilder {
"render"
};
self.source.push_str("sfrt::");
self.source.push_str("__sf_rt::");
self.source.push_str(method);
self.source.push_str("!(_ctx, ");
self.write_token(token);