Document From
trait for LhsExpr
This commit is contained in:
parent
b9de4ef89e
commit
194d357e03
@ -66,6 +66,10 @@ pub(super) enum LhsExpr {
|
||||
}
|
||||
|
||||
impl From<Option<ThinVec<Attribute>>> for LhsExpr {
|
||||
/// Converts `Some(attrs)` into `LhsExpr::AttributesParsed(attrs)`
|
||||
/// and `None` into `LhsExpr::NotYetParsed`.
|
||||
///
|
||||
/// This conversion does not allocate.
|
||||
fn from(o: Option<ThinVec<Attribute>>) -> Self {
|
||||
if let Some(attrs) = o {
|
||||
LhsExpr::AttributesParsed(attrs)
|
||||
@ -76,6 +80,9 @@ impl From<Option<ThinVec<Attribute>>> for LhsExpr {
|
||||
}
|
||||
|
||||
impl From<P<Expr>> for LhsExpr {
|
||||
/// Converts the `expr: P<Expr>` into `LhsExpr::AlreadyParsed(expr)`.
|
||||
///
|
||||
/// This conversion does not allocate.
|
||||
fn from(expr: P<Expr>) -> Self {
|
||||
LhsExpr::AlreadyParsed(expr)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user