swc_common::util::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 { ... }
}
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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Take for Option<T>

source§

fn dummy() -> Self

source§

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

Available on crate feature nightly only.
source§

fn dummy() -> Self

source§

impl<T> Take for Vec<T>

Available on crate feature nightly only.
source§

fn dummy() -> Self

source§

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

source§

fn dummy() -> Self

source§

impl<T> Take for Vec<T>

source§

fn dummy() -> Self

Implementors§