NativeMapper

Struct NativeMapper 

Source
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

Source

pub fn new(mapping: SourceMappingResult) -> Self

Creates a new mapper wrapping the given source mapping.

§Arguments
  • mapping - The source mapping result from macro expansion
Source

pub fn is_empty(&self) -> bool

Checks if this mapper has no mapping data.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>

Safety Read more
Source§

impl FromNapiRef for NativeMapper

Source§

unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>

Safety Read more
Source§

impl JavaScriptClassExt for NativeMapper

Source§

fn into_instance<'scope>( self, env: &'scope Env, ) -> Result<ClassInstance<'scope, Self>>

Source§

fn into_reference(self, env: Env) -> Result<Reference<Self>>

Source§

fn instance_of<'env, V: JsValue<'env>>(env: &Env, value: &V) -> Result<bool>

Source§

impl ObjectFinalize for NativeMapper

Source§

fn finalize(self, env: Env) -> Result<(), Error>

Source§

impl ToNapiValue for NativeMapper

Source§

impl TypeName for &NativeMapper

Source§

impl TypeName for &mut NativeMapper

Source§

impl TypeName for NativeMapper

Source§

impl ValidateNapiValue for &NativeMapper

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more
Source§

impl ValidateNapiValue for &mut NativeMapper

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> JsValuesTupleIntoVec for T
where T: ToNapiValue,

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Send for T
where T: ?Sized,

Source§

impl<T> Sync for T
where T: ?Sized,