API comment conventions redux
This commit is contained in:
parent
3c4f892d29
commit
e3998645f6
1 changed files with 8 additions and 8 deletions
|
@ -37,7 +37,7 @@ impl<'cx> Renderer<'cx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reify the `Renderer` into a block of markup.
|
/// Reifies the `Renderer` into a block of markup.
|
||||||
pub fn into_expr(self) -> P<Expr> {
|
pub fn into_expr(self) -> P<Expr> {
|
||||||
let Renderer { cx, stmts, w } = self;
|
let Renderer { cx, stmts, w } = self;
|
||||||
quote_expr!(cx,
|
quote_expr!(cx,
|
||||||
|
@ -47,31 +47,31 @@ impl<'cx> Renderer<'cx> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reify the `Renderer` into a raw list of statements.
|
/// Reifies the `Renderer` into a raw list of statements.
|
||||||
pub fn into_stmts(self) -> Vec<P<Stmt>> {
|
pub fn into_stmts(self) -> Vec<P<Stmt>> {
|
||||||
let Renderer { stmts, .. } = self;
|
let Renderer { stmts, .. } = self;
|
||||||
stmts
|
stmts
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append the list of statements to the output.
|
/// Appends the list of statements to the output.
|
||||||
pub fn push_stmts(&mut self, mut stmts: Vec<P<Stmt>>) {
|
pub fn push_stmts(&mut self, mut stmts: Vec<P<Stmt>>) {
|
||||||
self.stmts.append(&mut stmts);
|
self.stmts.append(&mut stmts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Push an expression statement, also wrapping it with `try!`.
|
/// Pushes an expression statement, also wrapping it with `try!`.
|
||||||
fn push_try(&mut self, expr: P<Expr>) {
|
fn push_try(&mut self, expr: P<Expr>) {
|
||||||
let stmt = self.cx.stmt_expr(self.cx.expr_try(expr.span, expr));
|
let stmt = self.cx.stmt_expr(self.cx.expr_try(expr.span, expr));
|
||||||
self.stmts.push(stmt);
|
self.stmts.push(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append a literal pre-escaped string.
|
/// Appends a literal pre-escaped string.
|
||||||
fn write(&mut self, s: &str) {
|
fn write(&mut self, s: &str) {
|
||||||
let w = self.w;
|
let w = self.w;
|
||||||
let expr = quote_expr!(self.cx, $w.write_str($s));
|
let expr = quote_expr!(self.cx, $w.write_str($s));
|
||||||
self.push_try(expr);
|
self.push_try(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append a literal string, with the specified escaping method.
|
/// Appends a literal string, with the specified escaping method.
|
||||||
pub fn string(&mut self, s: &str, escape: Escape) {
|
pub fn string(&mut self, s: &str, escape: Escape) {
|
||||||
let escaped;
|
let escaped;
|
||||||
let s = match escape {
|
let s = match escape {
|
||||||
|
@ -81,7 +81,7 @@ impl<'cx> Renderer<'cx> {
|
||||||
self.write(s);
|
self.write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append the result of an expression, with the specified escaping method.
|
/// Appends the result of an expression, with the specified escaping method.
|
||||||
pub fn splice(&mut self, expr: P<Expr>, escape: Escape) {
|
pub fn splice(&mut self, expr: P<Expr>, escape: Escape) {
|
||||||
let w = self.w;
|
let w = self.w;
|
||||||
let expr = match escape {
|
let expr = match escape {
|
||||||
|
@ -126,7 +126,7 @@ impl<'cx> Renderer<'cx> {
|
||||||
self.write(">");
|
self.write(">");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emit an `if` expression.
|
/// Emits an `if` expression.
|
||||||
///
|
///
|
||||||
/// The condition is a token tree (not an expression) so we don't
|
/// The condition is a token tree (not an expression) so we don't
|
||||||
/// need to special-case `if let`.
|
/// need to special-case `if let`.
|
||||||
|
|
Loading…
Add table
Reference in a new issue