mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-22 17:21:35 +00:00
added catch attribute to the Generator methods, consistent rust keyword name
This commit is contained in:
20
src/js.rs
20
src/js.rs
@ -374,25 +374,25 @@ extern "C" {
|
||||
extern {
|
||||
pub type Generator;
|
||||
|
||||
/// The return() method returns the given value and finishes the generator.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/return
|
||||
#[wasm_bindgen(method, structural, js_name = return)]
|
||||
pub fn gen_return(this: &Generator, value: &JsValue) -> JsValue;
|
||||
|
||||
/// The next() method returns an object with two properties done and value.
|
||||
/// You can also provide a parameter to the next method to send a value to the generator.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next
|
||||
#[wasm_bindgen(method, structural)]
|
||||
pub fn next(this: &Generator, value: &JsValue) -> JsValue;
|
||||
#[wasm_bindgen(method, structural, catch)]
|
||||
pub fn next(this: &Generator, value: &JsValue) -> Result<JsValue, JsValue>;
|
||||
|
||||
/// The return() method returns the given value and finishes the generator.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/return
|
||||
#[wasm_bindgen(method, structural, js_name = return)]
|
||||
pub fn return_(this: &Generator, value: &JsValue) -> JsValue;
|
||||
|
||||
/// The throw() method resumes the execution of a generator by throwing an error into it
|
||||
/// and returns an object with two properties done and value.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/throw
|
||||
#[wasm_bindgen(method, structural)]
|
||||
pub fn throw(this: &Generator, error: &Error) -> JsValue;
|
||||
#[wasm_bindgen(method, structural, catch)]
|
||||
pub fn throw(this: &Generator, error: &Error) -> Result<JsValue, JsValue>;
|
||||
}
|
||||
|
||||
// Map
|
||||
|
Reference in New Issue
Block a user