pub struct NativeMapper { /* private fields */ }Expand description
Wrapper around NativePositionMapper for NAPI compatibility.
This provides the same functionality as NativePositionMapper but with a
different JavaScript class name. Used internally by NativePlugin::get_mapper.
Implementations§
Source§impl NativeMapper
impl NativeMapper
Sourcepub fn new(mapping: SourceMappingResult) -> Self
pub fn new(mapping: SourceMappingResult) -> Self
Creates a new mapper wrapping the given source mapping.
§Arguments
mapping- The source mapping result from macro expansion
Sourcepub fn original_to_expanded(&self, pos: u32) -> u32
pub fn original_to_expanded(&self, pos: u32) -> u32
Converts a position in the original source to expanded source.
See NativePositionMapper::original_to_expanded for details.
Sourcepub fn expanded_to_original(&self, pos: u32) -> Option<u32>
pub fn expanded_to_original(&self, pos: u32) -> Option<u32>
Converts a position in the expanded source back to original.
See NativePositionMapper::expanded_to_original for details.
Sourcepub fn generated_by(&self, pos: u32) -> Option<String>
pub fn generated_by(&self, pos: u32) -> Option<String>
Returns the name of the macro that generated code at the given position.
See NativePositionMapper::generated_by for details.
Sourcepub fn map_span_to_original(
&self,
start: u32,
length: u32,
) -> Option<SpanResult>
pub fn map_span_to_original( &self, start: u32, length: u32, ) -> Option<SpanResult>
Maps a span from expanded source to original source.
See NativePositionMapper::map_span_to_original for details.
Sourcepub fn map_span_to_expanded(&self, start: u32, length: u32) -> SpanResult
pub fn map_span_to_expanded(&self, start: u32, length: u32) -> SpanResult
Maps a span from original source to expanded source.
See NativePositionMapper::map_span_to_expanded for details.
Sourcepub fn is_in_generated(&self, pos: u32) -> bool
pub fn is_in_generated(&self, pos: u32) -> bool
Checks if a position is inside macro-generated code.
See NativePositionMapper::is_in_generated for details.
Trait Implementations§
Source§impl FromNapiMutRef for NativeMapper
impl FromNapiMutRef for NativeMapper
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Source§impl FromNapiRef for NativeMapper
impl FromNapiRef for NativeMapper
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Source§impl JavaScriptClassExt for NativeMapper
impl JavaScriptClassExt for NativeMapper
fn into_instance<'scope>( self, env: &'scope Env, ) -> Result<ClassInstance<'scope, Self>>
fn into_reference(self, env: Env) -> Result<Reference<Self>>
fn instance_of<'env, V: JsValue<'env>>(env: &Env, value: &V) -> Result<bool>
Source§impl ToNapiValue for NativeMapper
impl ToNapiValue for NativeMapper
Source§unsafe fn to_napi_value(env: napi_env, val: NativeMapper) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: NativeMapper) -> Result<napi_value>
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeName for &NativeMapper
impl TypeName for &NativeMapper
Source§impl TypeName for &mut NativeMapper
impl TypeName for &mut NativeMapper
Source§impl TypeName for NativeMapper
impl TypeName for NativeMapper
Source§impl ValidateNapiValue for &NativeMapper
impl ValidateNapiValue for &NativeMapper
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Source§impl ValidateNapiValue for &mut NativeMapper
impl ValidateNapiValue for &mut NativeMapper
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Auto Trait Implementations§
impl Freeze for NativeMapper
impl RefUnwindSafe for NativeMapper
impl Send for NativeMapper
impl Sync for NativeMapper
impl Unpin for NativeMapper
impl UnwindSafe for NativeMapper
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more