Take

Trait Take 

Source
pub trait Take: Sized {
    // Required method
    fn dummy() -> Self;

    // Provided methods
    fn take(&mut self) -> Self { ... }
    fn map_with_mut<F>(&mut self, op: F)
       where F: FnOnce(Self) -> Self { ... }
}
Available on crate feature __common only.
Expand description

Helper for people who are working on VisitMut.

This trait is implemented for ast nodes. If not and you need it, please file an issue.

Required Methods§

Source

fn dummy() -> Self

Create a dummy value of this type.

Provided Methods§

Source

fn take(&mut self) -> Self

Source

fn map_with_mut<F>(&mut self, op: F)
where F: FnOnce(Self) -> Self,

Mutate self using op, which accepts owned data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Take for Option<T>

Source§

impl<T> Take for Box<T>
where T: Take,

Source§

fn dummy() -> Box<T>

Source§

impl<T> Take for Vec<T>

Source§

fn dummy() -> Vec<T>

Implementors§

Source§

impl Take for AssignTarget

Source§

impl Take for AssignTargetPat

Source§

impl Take for BlockStmtOrExpr

Source§

impl Take for Callee

Source§

impl Take for ClassMember

Source§

impl Take for Decl

Source§

impl Take for Expr

Source§

impl Take for ForHead

Source§

impl Take for JSXElementName

Source§

impl Take for Key

Source§

impl Take for MemberProp

Source§

impl Take for ModuleDecl

Source§

impl Take for ModuleItem

Source§

impl Take for Pat

Source§

impl Take for Program

Source§

impl Take for PropName

Source§

impl Take for PropOrSpread

Source§

impl Take for SimpleAssignTarget

Source§

impl Take for Stmt

Source§

impl Take for SuperProp

Source§

impl Take for VarDeclOrExpr

Source§

impl Take for ArrayLit

Source§

impl Take for ArrowExpr

Source§

impl Take for AssignExpr

Source§

impl Take for AutoAccessor

Source§

impl Take for BinExpr

Source§

impl Take for BindingIdent

Source§

impl Take for BlockStmt

Source§

impl Take for Bool

Source§

impl Take for CallExpr

Source§

impl Take for Class

Source§

impl Take for ClassDecl

Source§

impl Take for ClassExpr

Source§

impl Take for ComputedPropName

Source§

impl Take for CondExpr

Source§

impl Take for ExportAll

Source§

impl Take for FnDecl

Source§

impl Take for FnExpr

Source§

impl Take for ForOfStmt

Source§

impl Take for Function

Source§

impl Take for Ident

Source§

impl Take for IdentName

Source§

impl Take for Import

Source§

impl Take for ImportDecl

Source§

impl Take for Invalid

Source§

impl Take for JSXClosingFragment

Source§

impl Take for JSXElement

Source§

impl Take for JSXFragment

Source§

impl Take for JSXOpeningElement

Source§

impl Take for JSXOpeningFragment

Source§

impl Take for MemberExpr

Source§

impl Take for Module

Source§

impl Take for NamedExport

Source§

impl Take for NewExpr

Source§

impl Take for Null

Source§

impl Take for ObjectLit

Source§

impl Take for OptCall

Source§

impl Take for OptChainExpr

Source§

impl Take for ParenExpr

Source§

impl Take for Regex

Source§

impl Take for Script

Source§

impl Take for SeqExpr

Source§

impl Take for SpreadElement

Source§

impl Take for StaticBlock

Source§

impl Take for Str

Source§

impl Take for Super

Source§

impl Take for SwitchCase

Source§

impl Take for TaggedTpl

Source§

impl Take for ThisExpr

Source§

impl Take for Tpl

Source§

impl Take for TplElement

Source§

impl Take for UnaryExpr

Source§

impl Take for UpdateExpr

Source§

impl Take for UsingDecl

Source§

impl Take for VarDecl

Source§

impl Take for VarDeclarator

Source§

impl Take for YieldExpr

Source§

impl Take for Span