[−][src]Struct js_sys::Iterator
Any object that conforms to the JS iterator protocol. For example,
something returned by myArray[Symbol.iterator]()
.
Methods
impl Iterator
[src]
impl Iterator
pub fn next(&self) -> Result<IteratorNext, JsValue>
[src]
pub fn next(&self) -> Result<IteratorNext, JsValue>
The next method always has to return an object with appropriate properties including done and value. If a non-object value gets returned (such as false or undefined), a TypeError ("iterator.next() returned a non-object value") will be thrown.
Methods from Deref<Target = JsValue>
pub const NULL: JsValue
[src]
pub const UNDEFINED: JsValue
[src]
pub const TRUE: JsValue
[src]
pub const FALSE: JsValue
[src]
pub fn as_f64(&self) -> Option<f64>
[src]
pub fn as_f64(&self) -> Option<f64>
Returns the f64
value of this JS value if it's an instance of a
number.
If this JS value is not an instance of a number then this returns
None
.
pub fn is_string(&self) -> bool
[src]
pub fn is_string(&self) -> bool
Tests whether this JS value is a JS string.
pub fn as_string(&self) -> Option<String>
[src]
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String
.
To avoid the copying and re-encoding, consider the
JsString::try_from()
function from js-sys
instead.
If this JS value is not an instance of a string or if it's not valid
utf-8 then this returns None
.
pub fn as_bool(&self) -> Option<bool>
[src]
pub fn as_bool(&self) -> Option<bool>
Returns the bool
value of this JS value if it's an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None
.
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
Tests whether this JS value is null
pub fn is_undefined(&self) -> bool
[src]
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
pub fn is_symbol(&self) -> bool
[src]
pub fn is_symbol(&self) -> bool
Tests whether the type of this JS value is symbol
pub fn is_object(&self) -> bool
[src]
pub fn is_object(&self) -> bool
Tests whether typeof self == "object" && self !== null
.
pub fn is_function(&self) -> bool
[src]
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function
.
Trait Implementations
impl AsRef<JsValue> for Iterator
[src]
impl AsRef<JsValue> for Iterator
impl From<JsValue> for Iterator
[src]
impl From<JsValue> for Iterator
impl From<Iterator> for JsValue
[src]
impl From<Iterator> for JsValue
impl<'a> IntoIterator for &'a Iterator
[src]
impl<'a> IntoIterator for &'a Iterator
type Item = Result<JsValue, JsValue>
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
ⓘImportant traits for Iter<'a>fn into_iter(self) -> Iter<'a>
[src]
fn into_iter(self) -> Iter<'a>
impl IntoIterator for Iterator
[src]
impl IntoIterator for Iterator
type Item = Result<JsValue, JsValue>
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
ⓘImportant traits for IntoIterfn into_iter(self) -> IntoIter
[src]
fn into_iter(self) -> IntoIter
impl Clone for Iterator
[src]
impl Clone for Iterator
fn clone(&self) -> Iterator
[src]
fn clone(&self) -> Iterator
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Iterator
[src]
impl Debug for Iterator
impl Deref for Iterator
[src]
impl Deref for Iterator
impl WasmDescribe for Iterator
[src]
impl WasmDescribe for Iterator
impl IntoWasmAbi for Iterator
[src]
impl IntoWasmAbi for Iterator
type Abi = <JsValue as IntoWasmAbi>::Abi
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
fn into_abi(self, extra: &mut dyn Stack) -> Self::Abi
[src]
fn into_abi(self, extra: &mut dyn Stack) -> Self::Abi
impl<'a> IntoWasmAbi for &'a Iterator
[src]
impl<'a> IntoWasmAbi for &'a Iterator
type Abi = <&'a JsValue as IntoWasmAbi>::Abi
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
fn into_abi(self, extra: &mut dyn Stack) -> Self::Abi
[src]
fn into_abi(self, extra: &mut dyn Stack) -> Self::Abi
impl FromWasmAbi for Iterator
[src]
impl FromWasmAbi for Iterator
type Abi = <JsValue as FromWasmAbi>::Abi
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
unsafe fn from_abi(js: Self::Abi, extra: &mut dyn Stack) -> Self
[src]
unsafe fn from_abi(js: Self::Abi, extra: &mut dyn Stack) -> Self
impl OptionFromWasmAbi for Iterator
[src]
impl OptionFromWasmAbi for Iterator
impl RefFromWasmAbi for Iterator
[src]
impl RefFromWasmAbi for Iterator
type Abi = <JsValue as RefFromWasmAbi>::Abi
The wasm ABI type references to Self
are recovered from.
type Anchor = ManuallyDrop<Iterator>
The type that holds the reference to Self
for the duration of the invocation of the function that has an &Self
parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi, extra: &mut dyn Stack) -> Self::Anchor
[src]
unsafe fn ref_from_abi(js: Self::Abi, extra: &mut dyn Stack) -> Self::Anchor
impl OptionIntoWasmAbi for Iterator
[src]
impl OptionIntoWasmAbi for Iterator
impl<'a> OptionIntoWasmAbi for &'a Iterator
[src]
impl<'a> OptionIntoWasmAbi for &'a Iterator
impl JsCast for Iterator
[src]
impl JsCast for Iterator
fn instanceof(val: &JsValue) -> bool
[src]
fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
[src]
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
[src]
fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn is_instance_of<T>(&self) -> bool where
T: JsCast,
[src]
fn is_instance_of<T>(&self) -> bool where
T: JsCast,
Test whether this JS value is an instance of the type T
. Read more
fn dyn_into<T>(self) -> Result<T, Self> where
T: JsCast,
[src]
fn dyn_into<T>(self) -> Result<T, Self> where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the target type T
. Read more
fn dyn_ref<T>(&self) -> Option<&T> where
T: JsCast,
[src]
fn dyn_ref<T>(&self) -> Option<&T> where
T: JsCast,
Performs a dynamic cast (checked at runtime) of this value into the target type T
. Read more
fn unchecked_into<T>(self) -> T where
T: JsCast,
[src]
fn unchecked_into<T>(self) -> T where
T: JsCast,
Performs a zero-cost unchecked cast into the specified type. Read more
fn unchecked_ref<T>(&self) -> &T where
T: JsCast,
[src]
fn unchecked_ref<T>(&self) -> &T where
T: JsCast,
Performs a zero-cost unchecked cast into a reference to the specified type. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T> From for T
[src]
impl<T> From for T
impl<I> IntoIterator for I where
I: Iterator,
[src]
impl<I> IntoIterator for I where
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
fn into_iter(self) -> I
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
[src]
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
fn return_abi(self, extra: &mut dyn Stack) -> <T as ReturnWasmAbi>::Abi
[src]
fn return_abi(self, extra: &mut dyn Stack) -> <T as ReturnWasmAbi>::Abi