Skip to main content

for_of

Function for_of 

Source
pub fn for_of<Callback, OtherError>(
    cx: *mut JSContext,
    iterable: HandleValue<'_>,
    callback: Callback,
) -> Result<(), ForOfIterationFailure<OtherError>>
where Callback: FnMut(HandleValue<'_>) -> Result<ControlFlow<()>, ForOfIterationFailure<OtherError>>,
Expand description

Helper for running for .. of iteration from rust.

If Ok() is returned then the iteration completed without unexpected failures.

The callback returns Err() to indicate a pending exception or Ok() containing a boolean value that is true if the iterator should continue iterating.