pub struct String<'js>(/* private fields */);
Expand description
Rust representation of a JavaScript string.
Implementations§
Source§impl<'js> String<'js>
impl<'js> String<'js>
Source§impl<'js> String<'js>
impl<'js> String<'js>
Sourcepub fn into_value(self) -> Value<'js>
pub fn into_value(self) -> Value<'js>
Convert into value
Sourcepub fn into_inner(self) -> Value<'js>
pub fn into_inner(self) -> Value<'js>
Returns the underlying super type.
Methods from Deref<Target = Value<'js>>§
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns if the value is the JavaScript undefined value.
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Check if the value is a function
Sourcepub fn is_constructor(&self) -> bool
pub fn is_constructor(&self) -> bool
Check if the value is a constructor function
Sourcepub fn is_promise(&self) -> bool
pub fn is_promise(&self) -> bool
Check if the value is a promise.
Sourcepub fn is_exception(&self) -> bool
pub fn is_exception(&self) -> bool
Check if the value is an exception
Sourcepub fn get<T>(&self) -> Result<T, Error>where
T: FromJs<'js>,
pub fn get<T>(&self) -> Result<T, Error>where
T: FromJs<'js>,
Convert from value to specified type
Sourcepub unsafe fn ref_string(&self) -> &String<'js>
pub unsafe fn ref_string(&self) -> &String<'js>
Sourcepub unsafe fn ref_symbol(&self) -> &Symbol<'js>
pub unsafe fn ref_symbol(&self) -> &Symbol<'js>
Sourcepub unsafe fn ref_object(&self) -> &Object<'js>
pub unsafe fn ref_object(&self) -> &Object<'js>
Sourcepub unsafe fn ref_function(&self) -> &Function<'js>
pub unsafe fn ref_function(&self) -> &Function<'js>
Sourcepub fn as_function(&self) -> Option<&Function<'js>>
pub fn as_function(&self) -> Option<&Function<'js>>
Try reinterpret as Function
Sourcepub unsafe fn ref_constructor(&self) -> &Constructor<'js>
pub unsafe fn ref_constructor(&self) -> &Constructor<'js>
Interpret as Constructor
§Safety
You should be sure that the value already is of required type before to do it.
Sourcepub fn as_constructor(&self) -> Option<&Constructor<'js>>
pub fn as_constructor(&self) -> Option<&Constructor<'js>>
Try reinterpret as Constructor
Sourcepub unsafe fn ref_promise(&self) -> &Promise<'js>
pub unsafe fn ref_promise(&self) -> &Promise<'js>
Sourcepub fn as_promise(&self) -> Option<&Promise<'js>>
pub fn as_promise(&self) -> Option<&Promise<'js>>
Try reinterpret as Promise
Sourcepub unsafe fn ref_exception(&self) -> &Exception<'js>
pub unsafe fn ref_exception(&self) -> &Exception<'js>
Sourcepub fn as_exception(&self) -> Option<&Exception<'js>>
pub fn as_exception(&self) -> Option<&Exception<'js>>
Try reinterpret as Exception
Sourcepub unsafe fn ref_big_int(&self) -> &BigInt<'js>
pub unsafe fn ref_big_int(&self) -> &BigInt<'js>
Sourcepub fn as_big_int(&self) -> Option<&BigInt<'js>>
pub fn as_big_int(&self) -> Option<&BigInt<'js>>
Try reinterpret as BigInt
Trait Implementations§
Source§impl<'js> JsLifetime<'js> for String<'js>
impl<'js> JsLifetime<'js> for String<'js>
impl<'js> StructuralPartialEq for String<'js>
Auto Trait Implementations§
impl<'js> Freeze for String<'js>
impl<'js> RefUnwindSafe for String<'js>
impl<'js> !Send for String<'js>
impl<'js> !Sync for String<'js>
impl<'js> Unpin for String<'js>
impl<'js> !UnwindSafe for String<'js>
Blanket Implementations§
Source§impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'js, T> FromParam<'js> for Twhere
T: FromJs<'js>,
impl<'js, T> FromParam<'js> for Twhere
T: FromJs<'js>,
Source§fn param_requirement() -> ParamRequirement
fn param_requirement() -> ParamRequirement
The parameters requirements this value requires.
Source§fn from_param<'a>(params: &mut ParamsAccessor<'a, 'js>) -> Result<T, Error>
fn from_param<'a>(params: &mut ParamsAccessor<'a, 'js>) -> Result<T, Error>
Convert from a parameter value.
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>
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 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>
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