Struct deno_ast::MultiThreadedComments
source · pub struct MultiThreadedComments { /* private fields */ }
Expand description
An implementation of swc’s Comments
that implements Sync
to support being used in multi-threaded code. This implementation
is immutable and should you need mutability you may create a copy
by converting it to an swc SingleThreadedComments
.
Implementations§
source§impl MultiThreadedComments
impl MultiThreadedComments
sourcepub fn from_single_threaded(comments: SingleThreadedComments) -> Self
pub fn from_single_threaded(comments: SingleThreadedComments) -> Self
Creates a new MultiThreadedComments
from an swc SingleThreadedComments
.
sourcepub fn as_single_threaded(&self) -> SingleThreadedComments
pub fn as_single_threaded(&self) -> SingleThreadedComments
Gets a clone of the underlying data as SingleThreadedComments
.
This may be useful for getting a mutable data structure for use when transpiling.
sourcepub fn leading_map(&self) -> &SingleThreadedCommentsMapInner
pub fn leading_map(&self) -> &SingleThreadedCommentsMapInner
Gets a reference to the leading comment map.
sourcepub fn trailing_map(&self) -> &SingleThreadedCommentsMapInner
pub fn trailing_map(&self) -> &SingleThreadedCommentsMapInner
Gets a reference to the trailing comment map.
pub fn has_leading(&self, pos: SourcePos) -> bool
pub fn get_leading(&self, pos: SourcePos) -> Option<&Vec<Comment>>
pub fn has_trailing(&self, pos: SourcePos) -> bool
pub fn get_trailing(&self, pos: SourcePos) -> Option<&Vec<Comment>>
pub fn as_swc_comments(&self) -> Box<dyn SwcComments>
Trait Implementations§
source§impl Clone for MultiThreadedComments
impl Clone for MultiThreadedComments
source§fn clone(&self) -> MultiThreadedComments
fn clone(&self) -> MultiThreadedComments
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for MultiThreadedComments
impl Send for MultiThreadedComments
impl Sync for MultiThreadedComments
impl Unpin for MultiThreadedComments
impl UnwindSafe for MultiThreadedComments
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more